mirror of
https://github.com/ArthurDanjou/handson-ml3.git
synced 2026-01-14 12:14:36 +01:00
Iris-Virginica => Iris virginica (& same for versicolor and setosa)
This commit is contained in:
@@ -1070,7 +1070,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"X = iris[\"data\"][:, 3:] # petal width\n",
|
||||
"y = (iris[\"target\"] == 2).astype(np.int) # 1 if Iris-Virginica, else 0"
|
||||
"y = (iris[\"target\"] == 2).astype(np.int) # 1 if Iris virginica, else 0"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1100,8 +1100,8 @@
|
||||
"X_new = np.linspace(0, 3, 1000).reshape(-1, 1)\n",
|
||||
"y_proba = log_reg.predict_proba(X_new)\n",
|
||||
"\n",
|
||||
"plt.plot(X_new, y_proba[:, 1], \"g-\", linewidth=2, label=\"Iris-Virginica\")\n",
|
||||
"plt.plot(X_new, y_proba[:, 0], \"b--\", linewidth=2, label=\"Not Iris-Virginica\")"
|
||||
"plt.plot(X_new, y_proba[:, 1], \"g-\", linewidth=2, label=\"Iris virginica\")\n",
|
||||
"plt.plot(X_new, y_proba[:, 0], \"b--\", linewidth=2, label=\"Not Iris virginica\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1125,8 +1125,8 @@
|
||||
"plt.plot(X[y==0], y[y==0], \"bs\")\n",
|
||||
"plt.plot(X[y==1], y[y==1], \"g^\")\n",
|
||||
"plt.plot([decision_boundary, decision_boundary], [-1, 2], \"k:\", linewidth=2)\n",
|
||||
"plt.plot(X_new, y_proba[:, 1], \"g-\", linewidth=2, label=\"Iris-Virginica\")\n",
|
||||
"plt.plot(X_new, y_proba[:, 0], \"b--\", linewidth=2, label=\"Not Iris-Virginica\")\n",
|
||||
"plt.plot(X_new, y_proba[:, 1], \"g-\", linewidth=2, label=\"Iris virginica\")\n",
|
||||
"plt.plot(X_new, y_proba[:, 0], \"b--\", linewidth=2, label=\"Not Iris virginica\")\n",
|
||||
"plt.text(decision_boundary+0.02, 0.15, \"Decision boundary\", fontsize=14, color=\"k\", ha=\"center\")\n",
|
||||
"plt.arrow(decision_boundary, 0.08, -0.3, 0, head_width=0.05, head_length=0.1, fc='b', ec='b')\n",
|
||||
"plt.arrow(decision_boundary, 0.92, 0.3, 0, head_width=0.05, head_length=0.1, fc='g', ec='g')\n",
|
||||
@@ -1191,8 +1191,8 @@
|
||||
"\n",
|
||||
"plt.clabel(contour, inline=1, fontsize=12)\n",
|
||||
"plt.plot(left_right, boundary, \"k--\", linewidth=3)\n",
|
||||
"plt.text(3.5, 1.5, \"Not Iris-Virginica\", fontsize=14, color=\"b\", ha=\"center\")\n",
|
||||
"plt.text(6.5, 2.3, \"Iris-Virginica\", fontsize=14, color=\"g\", ha=\"center\")\n",
|
||||
"plt.text(3.5, 1.5, \"Not Iris virginica\", fontsize=14, color=\"b\", ha=\"center\")\n",
|
||||
"plt.text(6.5, 2.3, \"Iris virginica\", fontsize=14, color=\"g\", ha=\"center\")\n",
|
||||
"plt.xlabel(\"Petal length\", fontsize=14)\n",
|
||||
"plt.ylabel(\"Petal width\", fontsize=14)\n",
|
||||
"plt.axis([2.9, 7, 0.8, 2.7])\n",
|
||||
@@ -1233,9 +1233,9 @@
|
||||
"zz = y_predict.reshape(x0.shape)\n",
|
||||
"\n",
|
||||
"plt.figure(figsize=(10, 4))\n",
|
||||
"plt.plot(X[y==2, 0], X[y==2, 1], \"g^\", label=\"Iris-Virginica\")\n",
|
||||
"plt.plot(X[y==1, 0], X[y==1, 1], \"bs\", label=\"Iris-Versicolor\")\n",
|
||||
"plt.plot(X[y==0, 0], X[y==0, 1], \"yo\", label=\"Iris-Setosa\")\n",
|
||||
"plt.plot(X[y==2, 0], X[y==2, 1], \"g^\", label=\"Iris virginica\")\n",
|
||||
"plt.plot(X[y==1, 0], X[y==1, 1], \"bs\", label=\"Iris versicolor\")\n",
|
||||
"plt.plot(X[y==0, 0], X[y==0, 1], \"yo\", label=\"Iris setosa\")\n",
|
||||
"\n",
|
||||
"from matplotlib.colors import ListedColormap\n",
|
||||
"custom_cmap = ListedColormap(['#fafab0','#9898ff','#a0faa0'])\n",
|
||||
@@ -1717,9 +1717,9 @@
|
||||
"zz = y_predict.reshape(x0.shape)\n",
|
||||
"\n",
|
||||
"plt.figure(figsize=(10, 4))\n",
|
||||
"plt.plot(X[y==2, 0], X[y==2, 1], \"g^\", label=\"Iris-Virginica\")\n",
|
||||
"plt.plot(X[y==1, 0], X[y==1, 1], \"bs\", label=\"Iris-Versicolor\")\n",
|
||||
"plt.plot(X[y==0, 0], X[y==0, 1], \"yo\", label=\"Iris-Setosa\")\n",
|
||||
"plt.plot(X[y==2, 0], X[y==2, 1], \"g^\", label=\"Iris virginica\")\n",
|
||||
"plt.plot(X[y==1, 0], X[y==1, 1], \"bs\", label=\"Iris versicolor\")\n",
|
||||
"plt.plot(X[y==0, 0], X[y==0, 1], \"yo\", label=\"Iris setosa\")\n",
|
||||
"\n",
|
||||
"from matplotlib.colors import ListedColormap\n",
|
||||
"custom_cmap = ListedColormap(['#fafab0','#9898ff','#a0faa0'])\n",
|
||||
|
||||
Reference in New Issue
Block a user