Replace n_iter with max_iter in SGDClassifier
parent
c4e72ddc49
commit
fb3e68709e
|
@ -869,7 +869,7 @@
|
|||
" ax.text(4.5, 2.5, 3.8, \"Decision function $h$\", fontsize=15)\n",
|
||||
" ax.set_xlabel(r\"Petal length\", fontsize=15)\n",
|
||||
" ax.set_ylabel(r\"Petal width\", fontsize=15)\n",
|
||||
" ax.set_zlabel(r\"$h = \\mathbf{w}^t \\cdot \\mathbf{x} + b$\", fontsize=18)\n",
|
||||
" ax.set_zlabel(r\"$h = \\mathbf{w}^T \\mathbf{x} + b$\", fontsize=18)\n",
|
||||
" ax.legend(loc=\"upper left\", fontsize=16)\n",
|
||||
"\n",
|
||||
"fig = plt.figure(figsize=(11, 6))\n",
|
||||
|
@ -1165,7 +1165,7 @@
|
|||
"source": [
|
||||
"from sklearn.linear_model import SGDClassifier\n",
|
||||
"\n",
|
||||
"sgd_clf = SGDClassifier(loss=\"hinge\", alpha = 0.017, n_iter = 50, random_state=42)\n",
|
||||
"sgd_clf = SGDClassifier(loss=\"hinge\", alpha = 0.017, max_iter = 50, random_state=42)\n",
|
||||
"sgd_clf.fit(X, y.ravel())\n",
|
||||
"\n",
|
||||
"m = len(X)\n",
|
||||
|
@ -1235,9 +1235,7 @@
|
|||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 44,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from sklearn import datasets\n",
|
||||
|
@ -1267,7 +1265,7 @@
|
|||
"lin_clf = LinearSVC(loss=\"hinge\", C=C, random_state=42)\n",
|
||||
"svm_clf = SVC(kernel=\"linear\", C=C)\n",
|
||||
"sgd_clf = SGDClassifier(loss=\"hinge\", learning_rate=\"constant\", eta0=0.001, alpha=alpha,\n",
|
||||
" n_iter=100000, random_state=42)\n",
|
||||
" max_iter=100000, random_state=42)\n",
|
||||
"\n",
|
||||
"scaler = StandardScaler()\n",
|
||||
"X_scaled = scaler.fit_transform(X)\n",
|
||||
|
@ -1378,9 +1376,7 @@
|
|||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 48,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"np.random.seed(42)\n",
|
||||
|
@ -1605,9 +1601,7 @@
|
|||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 62,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from sklearn.datasets import fetch_california_housing\n",
|
||||
|
@ -1627,9 +1621,7 @@
|
|||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 63,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from sklearn.model_selection import train_test_split\n",
|
||||
|
@ -1647,9 +1639,7 @@
|
|||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 64,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from sklearn.preprocessing import StandardScaler\n",
|
||||
|
@ -1784,9 +1774,7 @@
|
|||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
|
@ -1807,7 +1795,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.6.3"
|
||||
"version": "3.5.2"
|
||||
},
|
||||
"nav_menu": {},
|
||||
"toc": {
|
||||
|
|
Loading…
Reference in New Issue