mirror of
https://github.com/ArthurDanjou/handson-ml3.git
synced 2026-01-14 12:14:36 +01:00
Update all notebooks assuming we are all in the future now: sklearn 0.20+, python 3.5+, TF 2.0 preview
This commit is contained in:
@@ -92,7 +92,7 @@
|
||||
"X = iris.data[:, (2, 3)] # petal length, petal width\n",
|
||||
"y = (iris.target == 0).astype(np.int)\n",
|
||||
"\n",
|
||||
"per_clf = Perceptron(max_iter=100, tol=-np.infty, random_state=42)\n",
|
||||
"per_clf = Perceptron(max_iter=1000, tol=1e-3, random_state=42)\n",
|
||||
"per_clf.fit(X, y)\n",
|
||||
"\n",
|
||||
"y_pred = per_clf.predict([[2, 0.5]])"
|
||||
@@ -474,7 +474,7 @@
|
||||
" plt.axis('off')\n",
|
||||
" plt.title(class_names[y_train[index]], fontsize=12)\n",
|
||||
"plt.subplots_adjust(wspace=0.2, hspace=0.5)\n",
|
||||
"save_fig('fashion_mnist', tight_layout=False)\n",
|
||||
"save_fig('fashion_mnist_diagram', tight_layout=False)\n",
|
||||
"plt.show()"
|
||||
]
|
||||
},
|
||||
@@ -668,7 +668,7 @@
|
||||
"source": [
|
||||
"model.compile(loss=keras.losses.sparse_categorical_crossentropy,\n",
|
||||
" optimizer=keras.optimizers.SGD(),\n",
|
||||
" metrics=[keras.metrics.Accuracy()])"
|
||||
" metrics=[keras.metrics.sparse_categorical_accuracy])"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -719,7 +719,7 @@
|
||||
"pd.DataFrame(history.history).plot(figsize=(8, 5))\n",
|
||||
"plt.grid(True)\n",
|
||||
"plt.gca().set_ylim(0, 1)\n",
|
||||
"save_fig(\"keras_learning_curve_graph\")\n",
|
||||
"save_fig(\"keras_learning_curves_graph\")\n",
|
||||
"plt.show()"
|
||||
]
|
||||
},
|
||||
@@ -1656,7 +1656,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 - tf2",
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user