mirror of
https://github.com/ArthurDanjou/handson-ml3.git
synced 2026-01-31 20:17:50 +01:00
Set tol=-np.infty to avoid a warning
This commit is contained in:
@@ -74,6 +74,13 @@
|
|||||||
"# Perceptrons"
|
"# Perceptrons"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"**Note**: we set `max_iter` and `tol` explicitly to avoid warnings about the fact that their default value will change in future versions of Scikit-Learn."
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": 2,
|
||||||
@@ -88,7 +95,7 @@
|
|||||||
"X = iris.data[:, (2, 3)] # petal length, petal width\n",
|
"X = iris.data[:, (2, 3)] # petal length, petal width\n",
|
||||||
"y = (iris.target == 0).astype(np.int)\n",
|
"y = (iris.target == 0).astype(np.int)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"per_clf = Perceptron(max_iter=100, random_state=42)\n",
|
"per_clf = Perceptron(max_iter=100, tol=-np.infty, random_state=42)\n",
|
||||||
"per_clf.fit(X, y)\n",
|
"per_clf.fit(X, y)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"y_pred = per_clf.predict([[2, 0.5]])"
|
"y_pred = per_clf.predict([[2, 0.5]])"
|
||||||
@@ -968,7 +975,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.5.2"
|
"version": "3.6.6"
|
||||||
},
|
},
|
||||||
"nav_menu": {
|
"nav_menu": {
|
||||||
"height": "264px",
|
"height": "264px",
|
||||||
|
|||||||
Reference in New Issue
Block a user