Add dual=True to LinearSVC and parser='auto' to fetch_openml
parent
e31ce8a44c
commit
d67673a290
|
@ -636,7 +636,8 @@
|
||||||
"\n",
|
"\n",
|
||||||
"from sklearn.datasets import fetch_openml\n",
|
"from sklearn.datasets import fetch_openml\n",
|
||||||
"\n",
|
"\n",
|
||||||
"X_mnist, y_mnist = fetch_openml('mnist_784', return_X_y=True, as_frame=False)\n",
|
"X_mnist, y_mnist = fetch_openml('mnist_784', return_X_y=True, as_frame=False,\n",
|
||||||
|
" parser='auto')\n",
|
||||||
"\n",
|
"\n",
|
||||||
"rnd_clf = RandomForestClassifier(n_estimators=100, random_state=42)\n",
|
"rnd_clf = RandomForestClassifier(n_estimators=100, random_state=42)\n",
|
||||||
"rnd_clf.fit(X_mnist, y_mnist)\n",
|
"rnd_clf.fit(X_mnist, y_mnist)\n",
|
||||||
|
@ -1305,6 +1306,13 @@
|
||||||
"from sklearn.neural_network import MLPClassifier"
|
"from sklearn.neural_network import MLPClassifier"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"Note: The `LinearSVC` has a `dual` hyperparameter whose default value will change from `True` to `\"auto\"` in Scikit-Learn 1.5. To ensure this notebook continues to produce the same outputs, I'm setting it explicitly to `True`. Please see the [documentation](https://scikit-learn.org/stable/modules/generated/sklearn.svm.LinearSVC.html) for more details."
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 42,
|
"execution_count": 42,
|
||||||
|
@ -1313,7 +1321,7 @@
|
||||||
"source": [
|
"source": [
|
||||||
"random_forest_clf = RandomForestClassifier(n_estimators=100, random_state=42)\n",
|
"random_forest_clf = RandomForestClassifier(n_estimators=100, random_state=42)\n",
|
||||||
"extra_trees_clf = ExtraTreesClassifier(n_estimators=100, random_state=42)\n",
|
"extra_trees_clf = ExtraTreesClassifier(n_estimators=100, random_state=42)\n",
|
||||||
"svm_clf = LinearSVC(max_iter=100, tol=20, random_state=42)\n",
|
"svm_clf = LinearSVC(max_iter=100, tol=20, dual=True, random_state=42)\n",
|
||||||
"mlp_clf = MLPClassifier(random_state=42)"
|
"mlp_clf = MLPClassifier(random_state=42)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -2045,7 +2053,7 @@
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3",
|
"display_name": "Python 3 (ipykernel)",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
|
@ -2059,7 +2067,7 @@
|
||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.6"
|
"version": "3.10.13"
|
||||||
},
|
},
|
||||||
"nav_menu": {
|
"nav_menu": {
|
||||||
"height": "252px",
|
"height": "252px",
|
||||||
|
|
Loading…
Reference in New Issue