【发布时间】:2017-07-17 16:33:15
【问题描述】:
我正在使用 FeatureUnion 来加入从事件的标题和描述中找到的功能:
union = FeatureUnion(
transformer_list=[
# Pipeline for pulling features from the event's title
('title', Pipeline([
('selector', TextSelector(key='title')),
('count', CountVectorizer(stop_words='english')),
])),
# Pipeline for standard bag-of-words model for description
('description', Pipeline([
('selector', TextSelector(key='description_snippet')),
('count', TfidfVectorizer(stop_words='english')),
])),
],
transformer_weights ={
'title': 1.0,
'description': 0.2
},
)
但是,调用 union.get_feature_names() 会给我一个错误:“Transformer title (type Pipeline) 不提供 get_feature_names。”我想看看我的不同 Vectorizer 生成的一些功能。我该怎么做?
【问题讨论】:
-
您在调用
union.get_feature_names()时是否遇到任何错误? -
这是错误:“变压器标题(管道类型)不提供 get_feature_names。”
-
您可能想从另一个类似问题中查看此答案:stackoverflow.com/questions/28822756/…
标签: python-3.x scikit-learn nlp feature-extraction