使用get_params()
函数中,您可以访问管道的各个部分及其各自的内部参数。下面是一个访问的例子'vect'
text_clf = Pipeline([('vect', CountVectorizer()),
('tfidf', TfidfTransformer()),
('clf', MultinomialNB())]
print text_clf.get_params()['vect']
产量(对我来说)
CountVectorizer(analyzer=u'word', binary=False, decode_error=u'strict',
dtype=<type 'numpy.int64'>, encoding=u'utf-8', input=u'content',
lowercase=True, max_df=1.0, max_features=None, min_df=1,
ngram_range=(1, 1), preprocessor=None, stop_words=None,
strip_accents=None, token_pattern=u'(?u)\\b\\w\\w+\\b',
tokenizer=None, vocabulary=None)
我还没有将管道安装到本示例中的任何数据,因此调用get_feature_names()
此时会返回错误。