mirror of
https://github.com/guezoloic/millesima-ai-engine.git
synced 2026-04-02 13:31:34 +00:00
fix(clearning.ipynb): changement cross_val_score en score
This commit is contained in:
@@ -2,19 +2,10 @@
|
|||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 31,
|
"execution_count": 1,
|
||||||
"id": "faafb9a0",
|
"id": "faafb9a0",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"The autoreload extension is already loaded. To reload it, use:\n",
|
|
||||||
" %reload_ext autoreload\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"%matplotlib inline\n",
|
"%matplotlib inline\n",
|
||||||
"%load_ext autoreload\n",
|
"%load_ext autoreload\n",
|
||||||
@@ -110,7 +101,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 32,
|
"execution_count": 2,
|
||||||
"id": "8342340f",
|
"id": "8342340f",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
@@ -135,7 +126,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 33,
|
"execution_count": 3,
|
||||||
"id": "9dfdc01f",
|
"id": "9dfdc01f",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
@@ -184,7 +175,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 34,
|
"execution_count": 4,
|
||||||
"id": "99de3ed7",
|
"id": "99de3ed7",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -217,7 +208,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 35,
|
"execution_count": 5,
|
||||||
"id": "09eca16d",
|
"id": "09eca16d",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -255,7 +246,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 36,
|
"execution_count": 6,
|
||||||
"id": "b94a89f2",
|
"id": "b94a89f2",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -332,7 +323,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 37,
|
"execution_count": 7,
|
||||||
"id": "4f1c169f",
|
"id": "4f1c169f",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -369,7 +360,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 38,
|
"execution_count": 8,
|
||||||
"id": "91cedffb",
|
"id": "91cedffb",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -466,7 +457,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 39,
|
"execution_count": 9,
|
||||||
"id": "4c21cd56",
|
"id": "4c21cd56",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -528,9 +519,9 @@
|
|||||||
"text/markdown": [
|
"text/markdown": [
|
||||||
"| Méthode | R² |\n",
|
"| Méthode | R² |\n",
|
||||||
"| :---: | :---: |\n",
|
"| :---: | :---: |\n",
|
||||||
"|AD|0.511089|\n",
|
"|AD|0.510519|\n",
|
||||||
"|Normalisation + AD|0.508518|\n",
|
"|Normalisation + AD|0.508927|\n",
|
||||||
"|Standardisation + AD|0.512649|\n"
|
"|Standardisation + AD|0.506827|\n"
|
||||||
],
|
],
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"<IPython.core.display.Markdown object>"
|
"<IPython.core.display.Markdown object>"
|
||||||
@@ -543,7 +534,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"best score= 0.512649496806262 depth= 5 method= Standardisation + AD\n"
|
"best score= 0.5105192880780061 depth= 5 method= AD\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -614,6 +605,14 @@
|
|||||||
"Refaites l’expérience avec un paramètre n_neigbors=5. L’augmentation du nombre de voisins considérés permet-elle de meilleurs résultats ? Si cette amélioration n’est pas significative, nous conserverons n_neighbors = 4 pour la suite, par souci de simplicité."
|
"Refaites l’expérience avec un paramètre n_neigbors=5. L’augmentation du nombre de voisins considérés permet-elle de meilleurs résultats ? Si cette amélioration n’est pas significative, nous conserverons n_neighbors = 4 pour la suite, par souci de simplicité."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "88185c62",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"Aucune amélioration signification par rapport au pré et post traitement"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "72869cf6",
|
"id": "72869cf6",
|
||||||
@@ -625,7 +624,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 40,
|
"execution_count": 10,
|
||||||
"id": "f72f499f",
|
"id": "f72f499f",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -641,9 +640,9 @@
|
|||||||
"text/markdown": [
|
"text/markdown": [
|
||||||
"| Méthode | R² |\n",
|
"| Méthode | R² |\n",
|
||||||
"| :---: | :---: |\n",
|
"| :---: | :---: |\n",
|
||||||
"|KNN|0.485764|\n",
|
"|KNN|0.463459|\n",
|
||||||
"|Normalisation + KNN|0.497729|\n",
|
"|Normalisation + KNN|0.465584|\n",
|
||||||
"|Standardisation + KNN|0.489906|\n"
|
"|Standardisation + KNN|0.480575|\n"
|
||||||
],
|
],
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"<IPython.core.display.Markdown object>"
|
"<IPython.core.display.Markdown object>"
|
||||||
@@ -664,9 +663,9 @@
|
|||||||
"text/markdown": [
|
"text/markdown": [
|
||||||
"| Méthode | R² |\n",
|
"| Méthode | R² |\n",
|
||||||
"| :---: | :---: |\n",
|
"| :---: | :---: |\n",
|
||||||
"|KNN|0.504888|\n",
|
"|KNN|0.492485|\n",
|
||||||
"|Normalisation + KNN|0.500504|\n",
|
"|Normalisation + KNN|0.485298|\n",
|
||||||
"|Standardisation + KNN|0.493475|\n"
|
"|Standardisation + KNN|0.495728|\n"
|
||||||
],
|
],
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"<IPython.core.display.Markdown object>"
|
"<IPython.core.display.Markdown object>"
|
||||||
@@ -679,7 +678,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"best score= 0.5048884037669835 neighbor= 5 method= KNN\n"
|
"best score= 0.49572822708745434 neighbor= 5 method= Standardisation + KNN\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -707,7 +706,7 @@
|
|||||||
" else make_pipeline(scaler(), KNeighborsRegressor(n_neighbors=n))\n",
|
" else make_pipeline(scaler(), KNeighborsRegressor(n_neighbors=n))\n",
|
||||||
" )\n",
|
" )\n",
|
||||||
" model.fit(X_train, y_train)\n",
|
" model.fit(X_train, y_train)\n",
|
||||||
" score: float = cross_val_score(model, X_train, y_train, cv=5).mean()\n",
|
" score: float = model.score(X_test, y_test)\n",
|
||||||
" knn_table.ajoutligne(f\"{name}\", score)\n",
|
" knn_table.ajoutligne(f\"{name}\", score)\n",
|
||||||
"\n",
|
"\n",
|
||||||
" if score > best_score_knn:\n",
|
" if score > best_score_knn:\n",
|
||||||
@@ -749,7 +748,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 41,
|
"execution_count": 11,
|
||||||
"id": "9f764f3a",
|
"id": "9f764f3a",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -759,8 +758,8 @@
|
|||||||
"| Méthode | R² |\n",
|
"| Méthode | R² |\n",
|
||||||
"| :---: | :---: |\n",
|
"| :---: | :---: |\n",
|
||||||
"|LR|0.452908|\n",
|
"|LR|0.452908|\n",
|
||||||
"|AD|0.512649|\n",
|
"|AD|0.510519|\n",
|
||||||
"|KNN|0.504888|\n"
|
"|KNN|0.495728|\n"
|
||||||
],
|
],
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"<IPython.core.display.Markdown object>"
|
"<IPython.core.display.Markdown object>"
|
||||||
@@ -773,7 +772,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"best_model= AD best_scaler= StandardScaler\n"
|
"best_model= AD best_scaler= DecisionTreeRegressor\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -813,7 +812,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 42,
|
"execution_count": 12,
|
||||||
"id": "9084e87e",
|
"id": "9084e87e",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -850,17 +849,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 43,
|
"execution_count": 13,
|
||||||
"id": "fdcdfb17",
|
"id": "fdcdfb17",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"0.3938363073944231"
|
"0.39383630739442343"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 43,
|
"execution_count": 13,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@@ -902,7 +901,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 44,
|
"execution_count": 14,
|
||||||
"id": "c4f6c27f",
|
"id": "c4f6c27f",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -912,7 +911,7 @@
|
|||||||
"<Axes: >"
|
"<Axes: >"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 44,
|
"execution_count": 14,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
},
|
},
|
||||||
@@ -947,7 +946,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 45,
|
"execution_count": 15,
|
||||||
"id": "2e512052",
|
"id": "2e512052",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -1134,7 +1133,7 @@
|
|||||||
"App_Haut-Médoc -0.070383"
|
"App_Haut-Médoc -0.070383"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 45,
|
"execution_count": 15,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@@ -1155,7 +1154,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 46,
|
"execution_count": 16,
|
||||||
"id": "4010aa12",
|
"id": "4010aa12",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -1165,7 +1164,7 @@
|
|||||||
"0.4489472637581393"
|
"0.4489472637581393"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 46,
|
"execution_count": 16,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@@ -1213,7 +1212,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 47,
|
"execution_count": 17,
|
||||||
"id": "1510f763",
|
"id": "1510f763",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -1222,9 +1221,9 @@
|
|||||||
"text/markdown": [
|
"text/markdown": [
|
||||||
"| Méthode | R² |\n",
|
"| Méthode | R² |\n",
|
||||||
"| :---: | :---: |\n",
|
"| :---: | :---: |\n",
|
||||||
"|Random Forest|0.496806|\n",
|
"|Random Forest|0.492518|\n",
|
||||||
"|Normalisation + RF|0.494283|\n",
|
"|Normalisation + RF|0.491729|\n",
|
||||||
"|Standardisation + RF|0.486890|\n"
|
"|Standardisation + RF|0.483625|\n"
|
||||||
],
|
],
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"<IPython.core.display.Markdown object>"
|
"<IPython.core.display.Markdown object>"
|
||||||
|
|||||||
Reference in New Issue
Block a user