我似乎无法调试此错误
from sklearn.pipeline import Pipeline, FeatureUnion
a = TextTransformer('description', max_features=50)
b = TextTransformer('features', max_features=10)
pipeline = Pipeline([
('feats', FeatureUnion([
('description',a ), # can pass in either a pipeline
('features',b ) # or a transformer
])),
('clf', LinearSVC()) # classifier
])
pipeline.fit(df, df['interest_level'])
TextTransformer类
class TextTransformer(BaseEstimator, TransformerMixin):
def __init__(self, column, max_features=5000):
self.tfidfVectorizer = TfidfVectorizer(use_idf=False, stop_words='english',
tokenizer=self._custom_tokenizer, analyzer='word',
max_features=max_features)
self._vectorizer = None
self._column = column
当我已经传递了2个参数时,我不明白max_features的多个参数在哪里。
我在这里错过了什么吗?