51
правка
Изменения
Замена первой картинки
# Запуск поиска по сетке.
<code> classifier = linear_model.SGDClassifier(random_state = 0, tol=1e-3) parameters_grid = { 'alpha' : np.linspace(0.00001, 0.0001, 15), 'learning_rate': ['optimal', 'constant', 'invscaling'], 'eta0' : np.linspace(0.00001, 0.0001, 15), 'max_iter' : np.arange(5,10), } cv = model_selection.StratifiedShuffleSplit(n_splits=10, test_size = 0.2) grid_cv = model_selection.GridSearchCV(classifier, parameters_grid, scoring = 'accuracy', cv = cv) grid_cv.fit(train_data, test_data)</code> <code> Out: GridSearchCV(cv=StratifiedShuffleSplit(n_splits=10, random_state=0, test_size=0.2, train_size=None), error_score=nan, estimator=SGDClassifier(alpha=0.0001, average=False, class_weight=None, early_stopping=False, epsilon=0.1, eta0=0.0, fit_intercept=True, l1_ratio=0.15, learning_rate='optimal', loss='hinge', max_iter=1000, n_iter_no_change=5, n_jobs=None, penalty='l2... 'eta0': array([Файл1.00000000e-05, 1.64285714e-05, 2.28571429e-05, 2.92857143e-05, 3.57142857e-05, 4.21428571e-05, 4.85714286e-05, 5.50000000e-05, 6.14285714e-05, 6.78571429e-05, 7.42857143e-05, 8.07142857e-05, 8.71428571e-05, 9.35714286e-05, 1.00000000e-04]), 'learning_rate':KNeighborsClassifier_exmpl.png|center|1000px['optimal', 'constant', 'invscaling'], 'max_iter': array([5, 6, 7, 8, 9] )}, pre_dispatch='2*n_jobs', refit=True, return_train_score=False, scoring='accuracy', verbose=0)</code>
=== Sklearn Grid search: важные атрибуты ===