250x250
반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- grad-cam
- login crawling
- UDF
- TensorFlow
- Counterfactual Explanations
- spark udf
- API
- 상관관계
- youtube data
- 유튜브 API
- integrated gradient
- tensorflow text
- requests
- subdag
- top_k
- GenericGBQException
- correlation
- Retry
- GCP
- BigQuery
- session 유지
- chatGPT
- flask
- airflow subdag
- Airflow
- gather_nd
- hadoop
- API Gateway
- 공분산
- XAI
Archives
- Today
- Total
데이터과학 삼학년
PMI(Pointwise Mutual Information); 점별 상호 정보량 본문
반응형
점별 상호 정보량 (Poinstwise Mutual Information)
- NLP에서 각 단어간 상관성을 확인하기위한 단위로 쓸 수 있는 개념
- 두 확률변수 사이의 상관성을 계량화하는 단위
- 두 확률 변수가 완전한 독립, 예를 들면 단어 A의 등장이 단어 B에 등장에 전혀 영향을 주지 않는 경우에 PMI값은 0이 됨
- 해당 수치는 두단어가 얼마나 자주 같이 등장하는지에 관한 정보를 수치화한 개념
- PMI 수치는 음수로 나올 수 있다. log(0)는 -inf 이기 때문 따라서 negative PMI를 핸들링하기 위해 아래식 처럼 capping해 줄 수 있음
- PMI를 구할때 주의할 점은 stopwords를 삭제할 필요가 있다는 것!!!
from nltk.collocations import BigramCollocationFinder, BigramAssocMeasures
from nltk.tokenize import word_tokenize
import nltk
nltk.download('punkt')
text = "this is a foo bar bar black sheep foo bar bar black sheep foo bar bar black sheep shep bar bar black sentence"
bigram_measures = BigramAssocMeasures()
finder = BigramCollocationFinder.from_words(word_tokenize(text))
for i in finder.score_ngrams(bigram_measures.pmi):
print(i)
참조
https://www.listendata.com/2022/06/pointwise-mutual-information-pmi.html
Pointwise mutual information (PMI) in NLP
This tutorial describes interpretation and calculation of Pointwise mutual information (PMI) in NLP. It also includes how to run PMI in Python and R.
www.listendata.com
728x90
반응형
LIST
'Natural Language Processing' 카테고리의 다른 글
language Model [uncased vs cased] (0) | 2023.09.09 |
---|---|
[크롤링] 로그인이 필요한 웹사이트 크롤링 방법(feat. requests) (0) | 2023.03.20 |
[크롤링] selenium implicitly Wait VS Explicitly Wait (0) | 2022.05.31 |
[크롤링] What is the differences between requests and selenium? (0) | 2022.05.27 |
ROUGE : text summarization metric (0) | 2022.05.09 |
Comments