2014-10-19 1 views
0

scikit-learn에서 TfidfVectorizor 기능을 사용하고 있습니다. "use_idf = True"를 사용하여 tf-idf 요소를 포함하려고합니다. 문서에서, 그 후에, result.idf_는 idf 가중치의 배열과 모양을 반환해야하지만, 나는 "None"을 얻고있다. 아래는 제 입력과 출력입니다. (나는 결국 min_df와 max_df가 내 결과에 어떻게 영향을 미치는지 판단하려고 노력 중이므로 지금은 무작위 값이다.)scikit-learn에서 idf_에 대한 출력이 없습니다

tester =TfidfVectorizer(docs_train, min_df=.2, max_df=.8, use_idf=True) 

print tester 

TfidfVectorizer(analyzer=u'word', binary=False, charset=None, 
     charset_error=None, decode_error=u'strict', 
     dtype=<type 'numpy.int64'>, encoding=u'utf-8', 
     input=["today , war became a reality to me after seeing a screening of saving  priivate ryan . \nsteve spielberg goes beyond reality with his latest production . \nthe audience is tossed about the theatre witnessing the horror of war . \nplease keep the kids home as the r rating is for reality . \nto...esting motif out of the ubiquitous palmetto bugs-but nothing can freshen up this stale script . \n'], 
    lowercase=True, max_df=0.8, max_features=None, min_df=0.2, 
    ngram_range=(1, 1), norm=u'l2', preprocessor=None, smooth_idf=True, 
    stop_words=None, strip_accents=None, sublinear_tf=False, 
    token_pattern=u'(?u)\\b\\w\\w+\\b', tokenizer=None, use_idf=True, 
    vocabulary=None) 

print tester.idf_ 

None 

답변

0

벡터화 프로그램에 데이터를 제공하지 않았습니다. fit 또는 fit_transform으로해야합니다.

+0

그래, 나는이 부분을 완전히 놓쳤다. 그리고 그것은 나의 문제를 해결했다. 고맙습니다! – lilyrobin

관련 문제