본문 바로가기

STACKOVERFLOW 1일 1질문

사이킷 런, 카운터벡터라이저에서의 min_df와 max_df 이해하기

https://stackoverflow.com/questions/27697766/understanding-min-df-and-max-df-in-scikit-countvectorizer/35615151

 

Understanding min_df and max_df in scikit CountVectorizer

I have five text files that I input to a CountVectorizer. When specifying min_df and max_df to the CountVectorizer instance what does the min/max document frequency exactly means? Is it the frequen...

stackoverflow.com

1. max_df는 너무 자주 나타나는 단어를 지우기 위해 사용됩니다.  이런 단어를 코퍼스 특이적 불용어(corpus-specific stopwords)라고 부릅니다.

 

- max_df = 0.50의 의미는 "문서에서 50% 이상 나온 단어를 무시해"라는 의미다.

- max_df = 25가 의미하는 거은 "25번 이상 나온 단어를 무시해"라는 의미다.

 

max_df의 기본값은 1.0으로, 이 값은 모든 문서에서 출현한 단어에 대해서 무시하라는 의미이다. 즉 기본 값은 어떤 단어도 무시하지 말라는 말이다.

 

 

2. min_df는 너무 희소하게 나오는 단어를 제거하라는 뜻이다. 

 

- min_df = 0.01이 의미하는 것은 1%이하로 나온 문서를 무시하라는 의미이다.

- min_df = 5가 의미하는 것은 5개 이하로 나온 단어에 대해서 무시하라는 의미이다.

 

기본값은 1이며, 이것은 1번 이하로 나온 단어를 무시하라는 말로, 어떤 단어도 무시하지 말라는 의미다.