Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sklearn.pipeline import Pipeline
- from sklearn.model_selection import GridSearchCV
- from sklearn.linear_model import LogisticRegression
- pipe = Pipeline([('count_vec', CountVectorizer()),
- ('lr', LogisticRegression(solver='liblinear'))])
- pipe_params = {'remove_stopwords': [None, 'english'],'ngram_vec': [(1,1,)(2,2), (1,3)],'lr__C': [0.01, 1]}
- gs = GridSearchCV(pipe, param_grid=pipe_params, cv=3)
- gs_fit=gs.fit(count_vec['label'])
- pd.df(gs_fit.cv_results).sort_values('mean_test_score',ascending=False).head
- TypeError Traceback (most recent call last)
- <ipython-input-20-e9e666a843e5> in <module>
- 11
- 12 gs = GridSearchCV(pipe, param_grid=pipe_params, cv=3)
- ---> 13 gs_fit=gs.fit(count_vec['label'])
- 14 pd.df(gs_fit.cv_results).sort_values('mean_test_score',ascending=False).head()
- 15
- TypeError: 'CountVectorizer' object is not subscriptable`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement