TF-IDF: Difference between revisions
From IT Wiki
No edit summary |
No edit summary |
||
Line 51: | Line 51: | ||
| new || 1/7 || Log(2/1) = 0.3 || 0.04 | | new || 1/7 || Log(2/1) = 0.3 || 0.04 | ||
|- | |- | ||
| car || 3/7 || Log(2/1) = 0.3 || '''0.13''' | | '''car''' || 3/7 || Log(2/1) = 0.3 || '''0.13''' | ||
|- | |- | ||
| used || 1/7 || Log(2/1) = 0.3 || 0.04 | | used || 1/7 || Log(2/1) = 0.3 || 0.04 | ||
Line 59: | Line 59: | ||
| a || 2/8 || Log(2/2) = 0 || 0 | | a || 2/8 || Log(2/2) = 0 || 0 | ||
|- | |- | ||
| friend || 2/8 || Log(2/1) = 0.3 || 0.08 | | '''friend''' || 2/8 || Log(2/1) = 0.3 || '''0.08''' | ||
|- | |- | ||
| in || 1/8 || Log(2/1) = 0.3 || 0.04 | | in || 1/8 || Log(2/1) = 0.3 || 0.04 |
Revision as of 22:29, 28 December 2019
- Term Frequency - Inverse Document Frequency
TF Score
- TF = 단어의 출현 수 / 총 단어의 개수
- a new car, used car, car review
- TF Score를 통해 car가 중요한 단어라는 것을 확인하였음
단어 | TF Score |
---|---|
a | 1/7 |
new | 1/7 |
car | 3/7 |
used | 1/7 |
review | 1/7 |
- a friend in need is a friend indeed
- TF Score를 측정했는데 Friend와 a가 동일한 중요도로 산출됨
- 이런 경우를 보완하기 위해 IDF 사용
단어 | TF Score |
---|---|
a | 2/8 |
friend | 2/8 |
in | 1/8 |
need | 1/8 |
is | 1/8 |
indeed | 1/8 |
IDF
- IDF = Log (이 단어가 사용된 문장의 수 / 총 문장의 수+1)
- TF에 IDF를 적용하면, a/the/in/is 와 같은 의미 없는 불용어를 희석시킬 수 있다.
단어 | TF Score | IDF Score | TF * IDF |
---|---|---|---|
a | 1/7 | Log(2/2) = 0 | 0 |
new | 1/7 | Log(2/1) = 0.3 | 0.04 |
car | 3/7 | Log(2/1) = 0.3 | 0.13 |
used | 1/7 | Log(2/1) = 0.3 | 0.04 |
review | 1/7 | Log(2/1) = 0.3 | 0.04 |
a | 2/8 | Log(2/2) = 0 | 0 |
friend | 2/8 | Log(2/1) = 0.3 | 0.08 |
in | 1/8 | Log(2/1) = 0.3 | 0.04 |
need | 1/8 | Log(2/1) = 0.3 | 0.04 |
is | 1/8 | Log(2/1) = 0.3 | 0.04 |
indeed | 1/8 | Log(2/1) = 0.3 | 0.04 |