Commit 5d87da76 authored by Rémy Huet's avatar Rémy Huet 💻
Browse files

Fin TP6

parent 21870265
{}
\ No newline at end of file
......@@ -337,8 +337,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
......
......@@ -170,7 +170,8 @@
"metadata": {},
"outputs": [],
"source": [
"print(svc.C)"
"print(svc.C)\n",
"print(svc.gamma)"
]
},
{
......@@ -251,23 +252,38 @@
"estimator = make_pipeline(pca, svc)\n",
"\n",
"parameters = {\n",
" 'pca__n_components': range(100),\n",
" 'pca__n_components': [80, 90, 100, 110],\n",
" 'svc__C' : np.logspace(-2, 3, 10),\n",
" 'svc__gamma' : np.logspace(-4, 1, 10)\n",
"}\n",
"\n",
"clf = GridSearchCV(estimator, parameters)\n",
"clf.fit(X_train_pca, y_train)\n",
"clf.fit(X_train, y_train)\n",
"clf.best_params_"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Save the output of the previous cell (because it takes more than 45m to run) :\n",
"\n",
"```\n",
"{'pca__n_components': 100,\n",
" 'svc__C': 5.994842503189409,\n",
" 'svc__gamma': 0.004641588833612782}\n",
"```\n",
"\n",
"We retrieve the same parameters as preceding tests."
]
}
],
"metadata": {
"interpreter": {
"hash": "3abb0a1ef4892304d86bb3a3dfd052bcca35057beadba016173999c775e8d3ba"
"hash": "78ff2a7d75990e26f7862f23aec114522929670ec71bbfd9a70bdb18a9100993"
},
"kernelspec": {
"display_name": "Python 3.9.7 64-bit ('AOS1-QteoCFsS': pipenv)",
"display_name": "Python 3.9.7 64-bit ('AOS1-3HAiNONq': pipenv)",
"name": "python3"
},
"language_info": {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment