November 2018
Beginner to intermediate
182 pages
4h 48m
English
We will now run GridSearch for our selected parameters. Here, we are choosing to include bigrams and trigrams while running GridSearch over the C parameter of LogisticRegression.
Our intention here is to automate as much as possible. Instead of trying varying values in C during our RandomizedSearch, we are trading off human learning time (a few hours) with compute time (a few extra minutes). This mindset saves us both time and effort.
from sklearn.model_selection import GridSearchCVparam_grid = dict(clf__C=[85, 100, 125, 150])grid_search = GridSearchCV(lr_clf, param_grid=param_grid, scoring='accuracy', n_jobs=-1, cv=3)grid_search.fit(X_train, y_train)grid_search.best_estimator_.steps
In the preceding lines of code, we have ran ...
Read now
Unlock full access