Tải bản đầy đủ (.doc) (3 trang)

Đề thi học kì môn máy học chuyên ngành công nghệ thông tin

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (92.74 KB, 3 trang )

Bài toán 1. Phân loại văn bản tiếng Việt bằng phương pháp K-NN hoặc Bayes
Training Phase:
Input: D={d1,…dn}: collection of documents that has been assignment in to C.
C={c1, ,ck}: catergories.
Output: Detemining representation of each catergorie
Processing:
- In D segment into 2 word sets: noun set and other word set.
- Calculate F(w
i
) in noun set by:
D
iD
i
N
wN
wF
)(
)(
=
- For each catergories select all word that is noun and threshold s>0. And with each
catergories we have a representation for it.
Testing phase
Input: d: document
Output: d has been assigned by catergories C.
Reprocessing:
- d has been segmented into 2 word sets: noun set and other word set (not noun).
- Calculate I(w
i
) in noun set by:
)(
)(


)(
i
dw
j
iS
i
wF
w
wN
wI
j
+=


- Reduce dimensional feature by remove all w
i
that have I(w
i
) <0.20
- d has been presentated by T
noun
={<t
1
; w
1
>, <t
2
; w
2
>, …,<t

m
; w
m
>}
Algorithm (Bayes)
with d, we will calculate probability for each catergories C
i
by eq:
Prob(d|C
i
) = Prob(C
i
|D)*Prob(t
1
|C
i
)*Prob(t
2
|C
i
) * * Prob(t
m
|C
i
)
We will predict d in C
k
that have Prob(d|C
k
) max.

Bài toán 2. Phân cụm văn bản tiếng Việt bằng phương pháp K-means hoặc phân cấp
Training Phase:
Input: D={d1,…dn}: collection of documents.
s:threshold
Output: clusters
Processing:
- In D segment into 2 word sets: noun set and other word set.
- Calculate F(w
i
) in noun set by:
D
iD
i
N
wN
wF
)(
)(
=
- For each catergories select all word that is noun and threshold s>0.
Algorithm of hierarchy is below
Bài toán 3. Tóm tắt văn bản tiếng Việt bằng phương pháp không giám sát
Training Phase:
Input: D={d1,…dn}: collection of documents.
Output: Calculated F(w
i
)
Processing:
- In D segment into 2 word sets: noun set and other word set.
- Calculate F(w

i
) in noun set by:
D
iD
i
N
wN
wF
)(
)(
=
Testing phase
Input: d: original document, r: rate of summary.
Output: d’: summary of document
Reprocessing:
- d has been segmented a set of sentences S={s
1
, s
2
, …, s
n
}
- In each sentence:
+ segment into 2 word sets: noun set and other word set (not noun).
+ Calculate I(w
i
) in noun set by:
)(
)(
)(

i
dw
j
iS
i
wF
w
wN
wI
j
+=


+P(s
i
)=1/i;
Algorithm:
V=” ”;
For each sentence calculating weight of sentence:
W(s
i
)= I(w
i
) + P(s
i
);
Sort (s
i
) by descending.
Length (d’)=length(d)*r%;

While (length(d’)< length(d)*r%)
V=V+s
i
;
Arrangements all selected sentence by the original document.
Ví dụ về thuật toán phân cụm văn bản dựa trên phân cấp.
- Input n văn bản đầu vào.
- Coi mỗi đối tượng là 1 cụm. (ví dụ có 3 văn bản thì 3 văn bản là 3 cụm).
- Trong mỗi văn bản tách các danh từ và tính tần suất các danh từ.
- Đo khoảng cách từng đôi một văn bản với nhau theo công thức:
- Đặt ngưỡng khoảng cách d(i,j).
- Output: Gom lại các cụm có khoảng cách d(i,j)<= ngưỡng.
Ví dụ:
Cho 3 văn bản đầu vào như dưới đây
Văn bản 1: Chiều nay, lớp D3tin thực hành máy tính.
Văn bản 2: Chiều nay, phòng máy tính A202 phải để cho lớp D4tin sử dụng.
Văn bản 3: Sáng nay, cô ấy đi xem bóng đá.
So sánh văn bản 1 và văn bản 2:
)|| |||(|),(
22
22
2
11 pp
j
x
i
x
j
x
i

x
j
x
i
xjid −++−+−=
*Tách từ chủ đề trong từng văn bản và tính tần xuất các từ chủ đề tạo thành các vector
biểu diễn đặc trưng cho mỗi văn bản.
D
1
={<lớp,0.3>; <d3tin,0.3>; <máy tính,0.6>}
D
2
={<phòng,0.1>; <máy tính,0.55>; <A202,0.12>; <lớp,0.2>; <D4tin,0.4>}.
D
3
={<cô ấy,0.6>; <bóng đá,0.2>}.
*Tính khoảng cách từng cặp văn bản:
d(1,2)=sqrt(|0.3-0.2|
2
+|0.6-0.55|
2
+|0-0.1|
2
+|0-0.12|
2
+|0.3-0|
2
+|0-0.4|
2
)

=sqrt(0.1
2
+0.05
2
+0.1
2
+0.12
2
+0.3
2
+0.4
2
).
d(1,3)=sqrt(0.3
2
+0.3
2
+0.6
2
+0.6
2
+0.2
2
).
Tương tự, tính d(2,3).
So sánh d(1,2) có khoảng cách nhỏ, do đó, văn bản 1 và văn bản 2 thuộc cùng 1 cụm.
Khi cho 3 văn bản trên là 3 văn bản đầu vào thì có thể gom lại thành 2 cụm.

×