add params for avoiding warn and improving perf.

main
rickiepark 2018-01-30 17:19:37 +09:00
parent 0f46b85009
commit 385d635e92
3 changed files with 8 additions and 8 deletions

View File

@ -1503,7 +1503,7 @@
"forest_reg = RandomForestRegressor(random_state=42)\n",
"# train across 5 folds, that's a total of (12+6)*5=90 rounds of training \n",
"grid_search = GridSearchCV(forest_reg, param_grid, cv=5,\n",
" scoring='neg_mean_squared_error')\n",
" scoring='neg_mean_squared_error', return_train_score=True)\n",
"grid_search.fit(housing_prepared, housing_labels)"
]
},

View File

@ -241,7 +241,7 @@
"source": [
"from sklearn.linear_model import SGDClassifier\n",
"\n",
"sgd_clf = SGDClassifier(random_state=42)\n",
"sgd_clf = SGDClassifier(max_iter=5, random_state=42)\n",
"sgd_clf.fit(X_train, y_train_5)"
]
},
@ -766,7 +766,7 @@
"outputs": [],
"source": [
"from sklearn.multiclass import OneVsOneClassifier\n",
"ovo_clf = OneVsOneClassifier(SGDClassifier(random_state=42))\n",
"ovo_clf = OneVsOneClassifier(SGDClassifier(max_iter=5, random_state=42))\n",
"ovo_clf.fit(X_train, y_train)\n",
"ovo_clf.predict([some_digit])"
]
@ -1185,7 +1185,7 @@
"param_grid = [{'weights': [\"uniform\", \"distance\"], 'n_neighbors': [3, 4, 5]}]\n",
"\n",
"knn_clf = KNeighborsClassifier()\n",
"grid_search = GridSearchCV(knn_clf, param_grid, cv=5, verbose=3)\n",
"grid_search = GridSearchCV(knn_clf, param_grid, cv=5, verbose=3, n_jobs=-1)\n",
"grid_search.fit(X_train, y_train)"
]
},

View File

@ -452,7 +452,7 @@
"outputs": [],
"source": [
"from sklearn.linear_model import SGDRegressor\n",
"sgd_reg = SGDRegressor(n_iter=50, penalty=None, eta0=0.1, random_state=42)\n",
"sgd_reg = SGDRegressor(max_iter=50, penalty=None, eta0=0.1, random_state=42)\n",
"sgd_reg.fit(X, y.ravel())"
]
},
@ -880,7 +880,7 @@
},
"outputs": [],
"source": [
"sgd_reg = SGDRegressor(penalty=\"l2\", random_state=42)\n",
"sgd_reg = SGDRegressor(max_iter=5, penalty=\"l2\", random_state=42)\n",
"sgd_reg.fit(X, y.ravel())\n",
"sgd_reg.predict([[1.5]])"
]
@ -981,7 +981,7 @@
"X_train_poly_scaled = poly_scaler.fit_transform(X_train)\n",
"X_val_poly_scaled = poly_scaler.transform(X_val)\n",
"\n",
"sgd_reg = SGDRegressor(n_iter=1,\n",
"sgd_reg = SGDRegressor(max_iter=1,\n",
" penalty=None,\n",
" eta0=0.0005,\n",
" warm_start=True,\n",
@ -1030,7 +1030,7 @@
"outputs": [],
"source": [
"from sklearn.base import clone\n",
"sgd_reg = SGDRegressor(n_iter=1, warm_start=True, penalty=None,\n",
"sgd_reg = SGDRegressor(max_iter=1, warm_start=True, penalty=None,\n",
" learning_rate=\"constant\", eta0=0.0005, random_state=42)\n",
"\n",
"minimum_val_error = float(\"inf\")\n",