mirror of
https://github.com/BreizhHardware/cours-ISEN-MD.git
synced 2026-01-18 16:47:24 +01:00
Obisidian vault auto-backup: 29-09-2025 14:49:21 on . 1 files edited
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 30,
|
||||
"id": "5a9a29a0",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -33,8 +33,6 @@
|
||||
"Requirement already satisfied: tzdata>=2022.7 in ./.venv/lib/python3.13/site-packages (from pandas) (2025.2)\n",
|
||||
"Requirement already satisfied: six>=1.5 in ./.venv/lib/python3.13/site-packages (from python-dateutil>=2.8.2->pandas) (1.17.0)\n",
|
||||
"Note: you may need to restart the kernel to use updated packages.\n",
|
||||
"Note: you may need to restart the kernel to use updated packages.\n",
|
||||
"Requirement already satisfied: matplotlib in ./.venv/lib/python3.13/site-packages (3.10.6)\n",
|
||||
"Requirement already satisfied: matplotlib in ./.venv/lib/python3.13/site-packages (3.10.6)\n",
|
||||
"Requirement already satisfied: contourpy>=1.0.1 in ./.venv/lib/python3.13/site-packages (from matplotlib) (1.3.3)\n",
|
||||
"Requirement already satisfied: cycler>=0.10 in ./.venv/lib/python3.13/site-packages (from matplotlib) (0.12.1)\n",
|
||||
@@ -46,29 +44,12 @@
|
||||
"Requirement already satisfied: pyparsing>=2.3.1 in ./.venv/lib/python3.13/site-packages (from matplotlib) (3.2.5)\n",
|
||||
"Requirement already satisfied: python-dateutil>=2.7 in ./.venv/lib/python3.13/site-packages (from matplotlib) (2.9.0.post0)\n",
|
||||
"Requirement already satisfied: six>=1.5 in ./.venv/lib/python3.13/site-packages (from python-dateutil>=2.7->matplotlib) (1.17.0)\n",
|
||||
"Requirement already satisfied: contourpy>=1.0.1 in ./.venv/lib/python3.13/site-packages (from matplotlib) (1.3.3)\n",
|
||||
"Requirement already satisfied: cycler>=0.10 in ./.venv/lib/python3.13/site-packages (from matplotlib) (0.12.1)\n",
|
||||
"Requirement already satisfied: fonttools>=4.22.0 in ./.venv/lib/python3.13/site-packages (from matplotlib) (4.60.0)\n",
|
||||
"Requirement already satisfied: kiwisolver>=1.3.1 in ./.venv/lib/python3.13/site-packages (from matplotlib) (1.4.9)\n",
|
||||
"Requirement already satisfied: numpy>=1.23 in ./.venv/lib/python3.13/site-packages (from matplotlib) (2.3.3)\n",
|
||||
"Requirement already satisfied: packaging>=20.0 in ./.venv/lib/python3.13/site-packages (from matplotlib) (25.0)\n",
|
||||
"Requirement already satisfied: pillow>=8 in ./.venv/lib/python3.13/site-packages (from matplotlib) (11.3.0)\n",
|
||||
"Requirement already satisfied: pyparsing>=2.3.1 in ./.venv/lib/python3.13/site-packages (from matplotlib) (3.2.5)\n",
|
||||
"Requirement already satisfied: python-dateutil>=2.7 in ./.venv/lib/python3.13/site-packages (from matplotlib) (2.9.0.post0)\n",
|
||||
"Requirement already satisfied: six>=1.5 in ./.venv/lib/python3.13/site-packages (from python-dateutil>=2.7->matplotlib) (1.17.0)\n",
|
||||
"Note: you may need to restart the kernel to use updated packages.\n",
|
||||
"Note: you may need to restart the kernel to use updated packages.\n",
|
||||
"Requirement already satisfied: scikit-learn in ./.venv/lib/python3.13/site-packages (1.7.2)\n",
|
||||
"Requirement already satisfied: scikit-learn in ./.venv/lib/python3.13/site-packages (1.7.2)\n",
|
||||
"Requirement already satisfied: numpy>=1.22.0 in ./.venv/lib/python3.13/site-packages (from scikit-learn) (2.3.3)\n",
|
||||
"Requirement already satisfied: scipy>=1.8.0 in ./.venv/lib/python3.13/site-packages (from scikit-learn) (1.16.2)\n",
|
||||
"Requirement already satisfied: joblib>=1.2.0 in ./.venv/lib/python3.13/site-packages (from scikit-learn) (1.5.2)\n",
|
||||
"Requirement already satisfied: threadpoolctl>=3.1.0 in ./.venv/lib/python3.13/site-packages (from scikit-learn) (3.6.0)\n",
|
||||
"Requirement already satisfied: numpy>=1.22.0 in ./.venv/lib/python3.13/site-packages (from scikit-learn) (2.3.3)\n",
|
||||
"Requirement already satisfied: scipy>=1.8.0 in ./.venv/lib/python3.13/site-packages (from scikit-learn) (1.16.2)\n",
|
||||
"Requirement already satisfied: joblib>=1.2.0 in ./.venv/lib/python3.13/site-packages (from scikit-learn) (1.5.2)\n",
|
||||
"Requirement already satisfied: threadpoolctl>=3.1.0 in ./.venv/lib/python3.13/site-packages (from scikit-learn) (3.6.0)\n",
|
||||
"Note: you may need to restart the kernel to use updated packages.\n",
|
||||
"Note: you may need to restart the kernel to use updated packages.\n"
|
||||
]
|
||||
}
|
||||
@@ -81,7 +62,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 31,
|
||||
"id": "5be8782b",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -100,7 +81,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": 32,
|
||||
"id": "70575266",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -121,7 +102,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": 33,
|
||||
"id": "eaffc443",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -190,7 +171,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": 34,
|
||||
"id": "d333dc4d",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -225,7 +206,7 @@
|
||||
"\n",
|
||||
"b. Analyse de la première instance:\n",
|
||||
" - Classe de la première instance: 5\n",
|
||||
" - Type de la classe: <class 'numpy.uint8'>\n",
|
||||
" - Type de la classe: <class 'str'>\n",
|
||||
" - Type de l'instance (données): <class 'numpy.ndarray'>\n",
|
||||
"\n",
|
||||
"=== Conclusion ===\n",
|
||||
@@ -275,7 +256,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": 35,
|
||||
"id": "c0966e7f",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -337,7 +318,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"execution_count": 36,
|
||||
"id": "b0560d20",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -418,7 +399,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"execution_count": 37,
|
||||
"id": "bff45d57",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -468,9 +449,856 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 38,
|
||||
"id": "e02058de",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<style>#sk-container-id-2 {\n",
|
||||
" /* Definition of color scheme common for light and dark mode */\n",
|
||||
" --sklearn-color-text: #000;\n",
|
||||
" --sklearn-color-text-muted: #666;\n",
|
||||
" --sklearn-color-line: gray;\n",
|
||||
" /* Definition of color scheme for unfitted estimators */\n",
|
||||
" --sklearn-color-unfitted-level-0: #fff5e6;\n",
|
||||
" --sklearn-color-unfitted-level-1: #f6e4d2;\n",
|
||||
" --sklearn-color-unfitted-level-2: #ffe0b3;\n",
|
||||
" --sklearn-color-unfitted-level-3: chocolate;\n",
|
||||
" /* Definition of color scheme for fitted estimators */\n",
|
||||
" --sklearn-color-fitted-level-0: #f0f8ff;\n",
|
||||
" --sklearn-color-fitted-level-1: #d4ebff;\n",
|
||||
" --sklearn-color-fitted-level-2: #b3dbfd;\n",
|
||||
" --sklearn-color-fitted-level-3: cornflowerblue;\n",
|
||||
"\n",
|
||||
" /* Specific color for light theme */\n",
|
||||
" --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n",
|
||||
" --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, white)));\n",
|
||||
" --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n",
|
||||
" --sklearn-color-icon: #696969;\n",
|
||||
"\n",
|
||||
" @media (prefers-color-scheme: dark) {\n",
|
||||
" /* Redefinition of color scheme for dark theme */\n",
|
||||
" --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n",
|
||||
" --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, #111)));\n",
|
||||
" --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n",
|
||||
" --sklearn-color-icon: #878787;\n",
|
||||
" }\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 {\n",
|
||||
" color: var(--sklearn-color-text);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 pre {\n",
|
||||
" padding: 0;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 input.sk-hidden--visually {\n",
|
||||
" border: 0;\n",
|
||||
" clip: rect(1px 1px 1px 1px);\n",
|
||||
" clip: rect(1px, 1px, 1px, 1px);\n",
|
||||
" height: 1px;\n",
|
||||
" margin: -1px;\n",
|
||||
" overflow: hidden;\n",
|
||||
" padding: 0;\n",
|
||||
" position: absolute;\n",
|
||||
" width: 1px;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-dashed-wrapped {\n",
|
||||
" border: 1px dashed var(--sklearn-color-line);\n",
|
||||
" margin: 0 0.4em 0.5em 0.4em;\n",
|
||||
" box-sizing: border-box;\n",
|
||||
" padding-bottom: 0.4em;\n",
|
||||
" background-color: var(--sklearn-color-background);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-container {\n",
|
||||
" /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n",
|
||||
" but bootstrap.min.css set `[hidden] { display: none !important; }`\n",
|
||||
" so we also need the `!important` here to be able to override the\n",
|
||||
" default hidden behavior on the sphinx rendered scikit-learn.org.\n",
|
||||
" See: https://github.com/scikit-learn/scikit-learn/issues/21755 */\n",
|
||||
" display: inline-block !important;\n",
|
||||
" position: relative;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-text-repr-fallback {\n",
|
||||
" display: none;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"div.sk-parallel-item,\n",
|
||||
"div.sk-serial,\n",
|
||||
"div.sk-item {\n",
|
||||
" /* draw centered vertical line to link estimators */\n",
|
||||
" background-image: linear-gradient(var(--sklearn-color-text-on-default-background), var(--sklearn-color-text-on-default-background));\n",
|
||||
" background-size: 2px 100%;\n",
|
||||
" background-repeat: no-repeat;\n",
|
||||
" background-position: center center;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* Parallel-specific style estimator block */\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-parallel-item::after {\n",
|
||||
" content: \"\";\n",
|
||||
" width: 100%;\n",
|
||||
" border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n",
|
||||
" flex-grow: 1;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-parallel {\n",
|
||||
" display: flex;\n",
|
||||
" align-items: stretch;\n",
|
||||
" justify-content: center;\n",
|
||||
" background-color: var(--sklearn-color-background);\n",
|
||||
" position: relative;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-parallel-item {\n",
|
||||
" display: flex;\n",
|
||||
" flex-direction: column;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-parallel-item:first-child::after {\n",
|
||||
" align-self: flex-end;\n",
|
||||
" width: 50%;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-parallel-item:last-child::after {\n",
|
||||
" align-self: flex-start;\n",
|
||||
" width: 50%;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-parallel-item:only-child::after {\n",
|
||||
" width: 0;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* Serial-specific style estimator block */\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-serial {\n",
|
||||
" display: flex;\n",
|
||||
" flex-direction: column;\n",
|
||||
" align-items: center;\n",
|
||||
" background-color: var(--sklearn-color-background);\n",
|
||||
" padding-right: 1em;\n",
|
||||
" padding-left: 1em;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"/* Toggleable style: style used for estimator/Pipeline/ColumnTransformer box that is\n",
|
||||
"clickable and can be expanded/collapsed.\n",
|
||||
"- Pipeline and ColumnTransformer use this feature and define the default style\n",
|
||||
"- Estimators will overwrite some part of the style using the `sk-estimator` class\n",
|
||||
"*/\n",
|
||||
"\n",
|
||||
"/* Pipeline and ColumnTransformer style (default) */\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-toggleable {\n",
|
||||
" /* Default theme specific background. It is overwritten whether we have a\n",
|
||||
" specific estimator or a Pipeline/ColumnTransformer */\n",
|
||||
" background-color: var(--sklearn-color-background);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* Toggleable label */\n",
|
||||
"#sk-container-id-2 label.sk-toggleable__label {\n",
|
||||
" cursor: pointer;\n",
|
||||
" display: flex;\n",
|
||||
" width: 100%;\n",
|
||||
" margin-bottom: 0;\n",
|
||||
" padding: 0.5em;\n",
|
||||
" box-sizing: border-box;\n",
|
||||
" text-align: center;\n",
|
||||
" align-items: start;\n",
|
||||
" justify-content: space-between;\n",
|
||||
" gap: 0.5em;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 label.sk-toggleable__label .caption {\n",
|
||||
" font-size: 0.6rem;\n",
|
||||
" font-weight: lighter;\n",
|
||||
" color: var(--sklearn-color-text-muted);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 label.sk-toggleable__label-arrow:before {\n",
|
||||
" /* Arrow on the left of the label */\n",
|
||||
" content: \"▸\";\n",
|
||||
" float: left;\n",
|
||||
" margin-right: 0.25em;\n",
|
||||
" color: var(--sklearn-color-icon);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 label.sk-toggleable__label-arrow:hover:before {\n",
|
||||
" color: var(--sklearn-color-text);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* Toggleable content - dropdown */\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-toggleable__content {\n",
|
||||
" display: none;\n",
|
||||
" text-align: left;\n",
|
||||
" /* unfitted */\n",
|
||||
" background-color: var(--sklearn-color-unfitted-level-0);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-toggleable__content.fitted {\n",
|
||||
" /* fitted */\n",
|
||||
" background-color: var(--sklearn-color-fitted-level-0);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-toggleable__content pre {\n",
|
||||
" margin: 0.2em;\n",
|
||||
" border-radius: 0.25em;\n",
|
||||
" color: var(--sklearn-color-text);\n",
|
||||
" /* unfitted */\n",
|
||||
" background-color: var(--sklearn-color-unfitted-level-0);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-toggleable__content.fitted pre {\n",
|
||||
" /* unfitted */\n",
|
||||
" background-color: var(--sklearn-color-fitted-level-0);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n",
|
||||
" /* Expand drop-down */\n",
|
||||
" display: block;\n",
|
||||
" width: 100%;\n",
|
||||
" overflow: visible;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n",
|
||||
" content: \"▾\";\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* Pipeline/ColumnTransformer-specific style */\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
|
||||
" color: var(--sklearn-color-text);\n",
|
||||
" background-color: var(--sklearn-color-unfitted-level-2);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
|
||||
" background-color: var(--sklearn-color-fitted-level-2);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* Estimator-specific style */\n",
|
||||
"\n",
|
||||
"/* Colorize estimator box */\n",
|
||||
"#sk-container-id-2 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
|
||||
" /* unfitted */\n",
|
||||
" background-color: var(--sklearn-color-unfitted-level-2);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
|
||||
" /* fitted */\n",
|
||||
" background-color: var(--sklearn-color-fitted-level-2);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-label label.sk-toggleable__label,\n",
|
||||
"#sk-container-id-2 div.sk-label label {\n",
|
||||
" /* The background is the default theme color */\n",
|
||||
" color: var(--sklearn-color-text-on-default-background);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* On hover, darken the color of the background */\n",
|
||||
"#sk-container-id-2 div.sk-label:hover label.sk-toggleable__label {\n",
|
||||
" color: var(--sklearn-color-text);\n",
|
||||
" background-color: var(--sklearn-color-unfitted-level-2);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* Label box, darken color on hover, fitted */\n",
|
||||
"#sk-container-id-2 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n",
|
||||
" color: var(--sklearn-color-text);\n",
|
||||
" background-color: var(--sklearn-color-fitted-level-2);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* Estimator label */\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-label label {\n",
|
||||
" font-family: monospace;\n",
|
||||
" font-weight: bold;\n",
|
||||
" display: inline-block;\n",
|
||||
" line-height: 1.2em;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-label-container {\n",
|
||||
" text-align: center;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* Estimator-specific */\n",
|
||||
"#sk-container-id-2 div.sk-estimator {\n",
|
||||
" font-family: monospace;\n",
|
||||
" border: 1px dotted var(--sklearn-color-border-box);\n",
|
||||
" border-radius: 0.25em;\n",
|
||||
" box-sizing: border-box;\n",
|
||||
" margin-bottom: 0.5em;\n",
|
||||
" /* unfitted */\n",
|
||||
" background-color: var(--sklearn-color-unfitted-level-0);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-estimator.fitted {\n",
|
||||
" /* fitted */\n",
|
||||
" background-color: var(--sklearn-color-fitted-level-0);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* on hover */\n",
|
||||
"#sk-container-id-2 div.sk-estimator:hover {\n",
|
||||
" /* unfitted */\n",
|
||||
" background-color: var(--sklearn-color-unfitted-level-2);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 div.sk-estimator.fitted:hover {\n",
|
||||
" /* fitted */\n",
|
||||
" background-color: var(--sklearn-color-fitted-level-2);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* Specification for estimator info (e.g. \"i\" and \"?\") */\n",
|
||||
"\n",
|
||||
"/* Common style for \"i\" and \"?\" */\n",
|
||||
"\n",
|
||||
".sk-estimator-doc-link,\n",
|
||||
"a:link.sk-estimator-doc-link,\n",
|
||||
"a:visited.sk-estimator-doc-link {\n",
|
||||
" float: right;\n",
|
||||
" font-size: smaller;\n",
|
||||
" line-height: 1em;\n",
|
||||
" font-family: monospace;\n",
|
||||
" background-color: var(--sklearn-color-background);\n",
|
||||
" border-radius: 1em;\n",
|
||||
" height: 1em;\n",
|
||||
" width: 1em;\n",
|
||||
" text-decoration: none !important;\n",
|
||||
" margin-left: 0.5em;\n",
|
||||
" text-align: center;\n",
|
||||
" /* unfitted */\n",
|
||||
" border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n",
|
||||
" color: var(--sklearn-color-unfitted-level-1);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".sk-estimator-doc-link.fitted,\n",
|
||||
"a:link.sk-estimator-doc-link.fitted,\n",
|
||||
"a:visited.sk-estimator-doc-link.fitted {\n",
|
||||
" /* fitted */\n",
|
||||
" border: var(--sklearn-color-fitted-level-1) 1pt solid;\n",
|
||||
" color: var(--sklearn-color-fitted-level-1);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* On hover */\n",
|
||||
"div.sk-estimator:hover .sk-estimator-doc-link:hover,\n",
|
||||
".sk-estimator-doc-link:hover,\n",
|
||||
"div.sk-label-container:hover .sk-estimator-doc-link:hover,\n",
|
||||
".sk-estimator-doc-link:hover {\n",
|
||||
" /* unfitted */\n",
|
||||
" background-color: var(--sklearn-color-unfitted-level-3);\n",
|
||||
" color: var(--sklearn-color-background);\n",
|
||||
" text-decoration: none;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"div.sk-estimator.fitted:hover .sk-estimator-doc-link.fitted:hover,\n",
|
||||
".sk-estimator-doc-link.fitted:hover,\n",
|
||||
"div.sk-label-container:hover .sk-estimator-doc-link.fitted:hover,\n",
|
||||
".sk-estimator-doc-link.fitted:hover {\n",
|
||||
" /* fitted */\n",
|
||||
" background-color: var(--sklearn-color-fitted-level-3);\n",
|
||||
" color: var(--sklearn-color-background);\n",
|
||||
" text-decoration: none;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* Span, style for the box shown on hovering the info icon */\n",
|
||||
".sk-estimator-doc-link span {\n",
|
||||
" display: none;\n",
|
||||
" z-index: 9999;\n",
|
||||
" position: relative;\n",
|
||||
" font-weight: normal;\n",
|
||||
" right: .2ex;\n",
|
||||
" padding: .5ex;\n",
|
||||
" margin: .5ex;\n",
|
||||
" width: min-content;\n",
|
||||
" min-width: 20ex;\n",
|
||||
" max-width: 50ex;\n",
|
||||
" color: var(--sklearn-color-text);\n",
|
||||
" box-shadow: 2pt 2pt 4pt #999;\n",
|
||||
" /* unfitted */\n",
|
||||
" background: var(--sklearn-color-unfitted-level-0);\n",
|
||||
" border: .5pt solid var(--sklearn-color-unfitted-level-3);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".sk-estimator-doc-link.fitted span {\n",
|
||||
" /* fitted */\n",
|
||||
" background: var(--sklearn-color-fitted-level-0);\n",
|
||||
" border: var(--sklearn-color-fitted-level-3);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".sk-estimator-doc-link:hover span {\n",
|
||||
" display: block;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* \"?\"-specific style due to the `<a>` HTML tag */\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 a.estimator_doc_link {\n",
|
||||
" float: right;\n",
|
||||
" font-size: 1rem;\n",
|
||||
" line-height: 1em;\n",
|
||||
" font-family: monospace;\n",
|
||||
" background-color: var(--sklearn-color-background);\n",
|
||||
" border-radius: 1rem;\n",
|
||||
" height: 1rem;\n",
|
||||
" width: 1rem;\n",
|
||||
" text-decoration: none;\n",
|
||||
" /* unfitted */\n",
|
||||
" color: var(--sklearn-color-unfitted-level-1);\n",
|
||||
" border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 a.estimator_doc_link.fitted {\n",
|
||||
" /* fitted */\n",
|
||||
" border: var(--sklearn-color-fitted-level-1) 1pt solid;\n",
|
||||
" color: var(--sklearn-color-fitted-level-1);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"/* On hover */\n",
|
||||
"#sk-container-id-2 a.estimator_doc_link:hover {\n",
|
||||
" /* unfitted */\n",
|
||||
" background-color: var(--sklearn-color-unfitted-level-3);\n",
|
||||
" color: var(--sklearn-color-background);\n",
|
||||
" text-decoration: none;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"#sk-container-id-2 a.estimator_doc_link.fitted:hover {\n",
|
||||
" /* fitted */\n",
|
||||
" background-color: var(--sklearn-color-fitted-level-3);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".estimator-table summary {\n",
|
||||
" padding: .5rem;\n",
|
||||
" font-family: monospace;\n",
|
||||
" cursor: pointer;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".estimator-table details[open] {\n",
|
||||
" padding-left: 0.1rem;\n",
|
||||
" padding-right: 0.1rem;\n",
|
||||
" padding-bottom: 0.3rem;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".estimator-table .parameters-table {\n",
|
||||
" margin-left: auto !important;\n",
|
||||
" margin-right: auto !important;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".estimator-table .parameters-table tr:nth-child(odd) {\n",
|
||||
" background-color: #fff;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".estimator-table .parameters-table tr:nth-child(even) {\n",
|
||||
" background-color: #f6f6f6;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".estimator-table .parameters-table tr:hover {\n",
|
||||
" background-color: #e0e0e0;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".estimator-table table td {\n",
|
||||
" border: 1px solid rgba(106, 105, 104, 0.232);\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".user-set td {\n",
|
||||
" color:rgb(255, 94, 0);\n",
|
||||
" text-align: left;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".user-set td.value pre {\n",
|
||||
" color:rgb(255, 94, 0) !important;\n",
|
||||
" background-color: transparent !important;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".default td {\n",
|
||||
" color: black;\n",
|
||||
" text-align: left;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".user-set td i,\n",
|
||||
".default td i {\n",
|
||||
" color: black;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".copy-paste-icon {\n",
|
||||
" background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNy4yIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjUgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTIwOCAwTDMzMi4xIDBjMTIuNyAwIDI0LjkgNS4xIDMzLjkgMTQuMWw2Ny45IDY3LjljOSA5IDE0LjEgMjEuMiAxNC4xIDMzLjlMNDQ4IDMzNmMwIDI2LjUtMjEuNSA0OC00OCA0OGwtMTkyIDBjLTI2LjUgMC00OC0yMS41LTQ4LTQ4bDAtMjg4YzAtMjYuNSAyMS41LTQ4IDQ4LTQ4ek00OCAxMjhsODAgMCAwIDY0LTY0IDAgMCAyNTYgMTkyIDAgMC0zMiA2NCAwIDAgNDhjMCAyNi41LTIxLjUgNDgtNDggNDhMNDggNTEyYy0yNi41IDAtNDgtMjEuNS00OC00OEwwIDE3NmMwLTI2LjUgMjEuNS00OCA0OC00OHoiLz48L3N2Zz4=);\n",
|
||||
" background-repeat: no-repeat;\n",
|
||||
" background-size: 14px 14px;\n",
|
||||
" background-position: 0;\n",
|
||||
" display: inline-block;\n",
|
||||
" width: 14px;\n",
|
||||
" height: 14px;\n",
|
||||
" cursor: pointer;\n",
|
||||
"}\n",
|
||||
"</style><body><div id=\"sk-container-id-2\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>SGDClassifier()</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-2\" type=\"checkbox\" checked><label for=\"sk-estimator-id-2\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>SGDClassifier</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.7/modules/generated/sklearn.linear_model.SGDClassifier.html\">?<span>Documentation for SGDClassifier</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"\">\n",
|
||||
" <div class=\"estimator-table\">\n",
|
||||
" <details>\n",
|
||||
" <summary>Parameters</summary>\n",
|
||||
" <table class=\"parameters-table\">\n",
|
||||
" <tbody>\n",
|
||||
" \n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('loss',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">loss </td>\n",
|
||||
" <td class=\"value\">'hinge'</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('penalty',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">penalty </td>\n",
|
||||
" <td class=\"value\">'l2'</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('alpha',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">alpha </td>\n",
|
||||
" <td class=\"value\">0.0001</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('l1_ratio',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">l1_ratio </td>\n",
|
||||
" <td class=\"value\">0.15</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('fit_intercept',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">fit_intercept </td>\n",
|
||||
" <td class=\"value\">True</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('max_iter',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">max_iter </td>\n",
|
||||
" <td class=\"value\">1000</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('tol',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">tol </td>\n",
|
||||
" <td class=\"value\">0.001</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('shuffle',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">shuffle </td>\n",
|
||||
" <td class=\"value\">True</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('verbose',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">verbose </td>\n",
|
||||
" <td class=\"value\">0</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('epsilon',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">epsilon </td>\n",
|
||||
" <td class=\"value\">0.1</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('n_jobs',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">n_jobs </td>\n",
|
||||
" <td class=\"value\">None</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('random_state',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">random_state </td>\n",
|
||||
" <td class=\"value\">None</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('learning_rate',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">learning_rate </td>\n",
|
||||
" <td class=\"value\">'optimal'</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('eta0',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">eta0 </td>\n",
|
||||
" <td class=\"value\">0.0</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('power_t',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">power_t </td>\n",
|
||||
" <td class=\"value\">0.5</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('early_stopping',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">early_stopping </td>\n",
|
||||
" <td class=\"value\">False</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('validation_fraction',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">validation_fraction </td>\n",
|
||||
" <td class=\"value\">0.1</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('n_iter_no_change',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">n_iter_no_change </td>\n",
|
||||
" <td class=\"value\">5</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('class_weight',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">class_weight </td>\n",
|
||||
" <td class=\"value\">None</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('warm_start',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">warm_start </td>\n",
|
||||
" <td class=\"value\">False</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" <tr class=\"default\">\n",
|
||||
" <td><i class=\"copy-paste-icon\"\n",
|
||||
" onclick=\"copyToClipboard('average',\n",
|
||||
" this.parentElement.nextElementSibling)\"\n",
|
||||
" ></i></td>\n",
|
||||
" <td class=\"param\">average </td>\n",
|
||||
" <td class=\"value\">False</td>\n",
|
||||
" </tr>\n",
|
||||
" \n",
|
||||
" </tbody>\n",
|
||||
" </table>\n",
|
||||
" </details>\n",
|
||||
" </div>\n",
|
||||
" </div></div></div></div></div><script>function copyToClipboard(text, element) {\n",
|
||||
" // Get the parameter prefix from the closest toggleable content\n",
|
||||
" const toggleableContent = element.closest('.sk-toggleable__content');\n",
|
||||
" const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n",
|
||||
" const fullParamName = paramPrefix ? `${paramPrefix}${text}` : text;\n",
|
||||
"\n",
|
||||
" const originalStyle = element.style;\n",
|
||||
" const computedStyle = window.getComputedStyle(element);\n",
|
||||
" const originalWidth = computedStyle.width;\n",
|
||||
" const originalHTML = element.innerHTML.replace('Copied!', '');\n",
|
||||
"\n",
|
||||
" navigator.clipboard.writeText(fullParamName)\n",
|
||||
" .then(() => {\n",
|
||||
" element.style.width = originalWidth;\n",
|
||||
" element.style.color = 'green';\n",
|
||||
" element.innerHTML = \"Copied!\";\n",
|
||||
"\n",
|
||||
" setTimeout(() => {\n",
|
||||
" element.innerHTML = originalHTML;\n",
|
||||
" element.style = originalStyle;\n",
|
||||
" }, 2000);\n",
|
||||
" })\n",
|
||||
" .catch(err => {\n",
|
||||
" console.error('Failed to copy:', err);\n",
|
||||
" element.style.color = 'red';\n",
|
||||
" element.innerHTML = \"Failed!\";\n",
|
||||
" setTimeout(() => {\n",
|
||||
" element.innerHTML = originalHTML;\n",
|
||||
" element.style = originalStyle;\n",
|
||||
" }, 2000);\n",
|
||||
" });\n",
|
||||
" return false;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"document.querySelectorAll('.fa-regular.fa-copy').forEach(function(element) {\n",
|
||||
" const toggleableContent = element.closest('.sk-toggleable__content');\n",
|
||||
" const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n",
|
||||
" const paramName = element.parentElement.nextElementSibling.textContent.trim();\n",
|
||||
" const fullParamName = paramPrefix ? `${paramPrefix}${paramName}` : paramName;\n",
|
||||
"\n",
|
||||
" element.setAttribute('title', fullParamName);\n",
|
||||
"});\n",
|
||||
"</script></body>"
|
||||
],
|
||||
"text/plain": [
|
||||
"SGDClassifier()"
|
||||
]
|
||||
},
|
||||
"execution_count": 38,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from sklearn.linear_model import SGDClassifier\n",
|
||||
"\n",
|
||||
"# a. Création d'un objet SGDClassifier\n",
|
||||
"sgd_classifier = SGDClassifier()\n",
|
||||
"\n",
|
||||
"# b. Application de la méthode fit avec les données de la question 14 (classification binaire)\n",
|
||||
"sgd_classifier.fit(X_train, y_train_5)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 40,
|
||||
"id": "e73e18a3",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"=== Prédiction de la première instance avec le modèle SGD ===\n",
|
||||
"\n",
|
||||
"Forme de la première instance: (1, 784)\n",
|
||||
"\n",
|
||||
"Prédiction du modèle:\n",
|
||||
"- Résultat: True\n",
|
||||
"- Type: <class 'numpy.bool'>\n",
|
||||
"\n",
|
||||
"Comparaison avec la réalité:\n",
|
||||
"- Vraie classe de la première instance: 5\n",
|
||||
"- Est-ce vraiment un '5'?: True\n",
|
||||
"- Prédiction du modèle: True\n",
|
||||
"\n",
|
||||
"Le modèle prédit: 'C'est un chiffre 5'\n",
|
||||
"\n",
|
||||
"=== Conclusion ===\n",
|
||||
"Prédiction: True\n",
|
||||
"Exactitude: Correct\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(\"=== Prédiction de la première instance avec le modèle SGD ===\\n\")\n",
|
||||
"\n",
|
||||
"# Extraire la première instance (celle de la question 8)\n",
|
||||
"premiere_instance = X.iloc[0:1] # Utiliser [0:1] pour garder la forme 2D nécessaire\n",
|
||||
"print(f\"Forme de la première instance: {premiere_instance.shape}\")\n",
|
||||
"\n",
|
||||
"# Prédire avec le modèle SGD entraîné\n",
|
||||
"prediction = sgd_classifier.predict(premiere_instance)\n",
|
||||
"print(f\"\\nPrédiction du modèle:\")\n",
|
||||
"print(f\"- Résultat: {prediction[0]}\")\n",
|
||||
"print(f\"- Type: {type(prediction[0])}\")\n",
|
||||
"\n",
|
||||
"# Vérification avec la vraie classe\n",
|
||||
"vraie_classe = Y.iloc[0]\n",
|
||||
"est_vraiment_5 = (vraie_classe == 5)\n",
|
||||
"\n",
|
||||
"print(f\"\\nComparaison avec la réalité:\")\n",
|
||||
"print(f\"- Vraie classe de la première instance: {vraie_classe}\")\n",
|
||||
"print(f\"- Est-ce vraiment un '5'?: {est_vraiment_5}\")\n",
|
||||
"print(f\"- Prédiction du modèle: {prediction[0]}\")\n",
|
||||
"\n",
|
||||
"# Résultat de la prédiction\n",
|
||||
"if prediction[0]:\n",
|
||||
" if est_vraiment_5:\n",
|
||||
" print(f\"\\nLe modèle prédit: 'C'est un chiffre 5'\")\n",
|
||||
" else :\n",
|
||||
" print(\"\\nLe modèle prédit: 'C'est un chiffre 5' (ERREUR)\")\n",
|
||||
"else:\n",
|
||||
" if est_vraiment_5:\n",
|
||||
" print(f\"\\nLe modèle prédit: 'Ce n'est PAS un chiffre 5' (ERREUR)\")\n",
|
||||
" else:\n",
|
||||
" print(\"\\nLe modèle prédit: 'Ce n'est PAS un chiffre 5'\")\n",
|
||||
"\n",
|
||||
"print(f\"\\n=== Conclusion ===\")\n",
|
||||
"print(f\"Prédiction: {'True' if prediction[0] else 'False'}\")\n",
|
||||
"print(f\"Exactitude: {'Correct' if prediction[0] == est_vraiment_5 else 'Incorrect'}\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "8aa1ea52",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 2-1- Taux de classification"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "acaeacd9",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user