首页 文章

在scikit-learn中没有输出idf_

提问于
浏览
0

我在scikit-learn中使用TfidfVectorizor函数 . 我试图使用“use_idf = True”包含tf-idf元素 . 在文档中,它说在此之后,result.idf_应该返回我的idf权重的数组和形状,但我得到“无” . 以下是我的输入和输出 . (我最终试图判断min_df和max_df如何影响我的结果,所以它们现在只是随机值) .

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

1 回答

  • 0

    你还没有为矢量化器提供任何数据 . 您应该使用 fitfit_transform 这样做 .

相关问题