Set tol=-np.infty to avoid a warning

main
Aurélien Geron 2018-12-21 11:53:42 +08:00
parent 95e3fbade3
commit 325fb2b9d4
1 changed files with 9 additions and 2 deletions

View File

@ -74,6 +74,13 @@
"# 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",
"execution_count": 2,
@ -88,7 +95,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, random_state=42)\n",
"per_clf = Perceptron(max_iter=100, tol=-np.infty, random_state=42)\n",
"per_clf.fit(X, y)\n",
"\n",
"y_pred = per_clf.predict([[2, 0.5]])"
@ -968,7 +975,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
"version": "3.6.6"
},
"nav_menu": {
"height": "264px",