mirror of
https://github.com/mudabbir-ahmad/UNI-PROG3-CW2-MLWP.git
synced 2026-10-07 20:10:20 +00:00
PART 1F
This commit is contained in:
1 parent
5776d4031f
commit
afc0105d5e
1 file changed
+871
-1
@@ -2058,13 +2058,883 @@
|
|||||||
],
|
],
|
||||||
"id": "eaefa3aed2214793"
|
"id": "eaefa3aed2214793"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"metadata": {},
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"source": "## Part F",
|
||||||
|
"id": "3c89e2f8ae31de3b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2026-04-25T15:14:41.668654900Z",
|
||||||
|
"start_time": "2026-04-25T15:14:41.650113100Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cell_type": "code",
|
||||||
|
"source": "features_to_test = ['Reviews', 'Size in bytes', 'Numeric Installs']",
|
||||||
|
"id": "ab09192a122e6e8f",
|
||||||
|
"outputs": [],
|
||||||
|
"execution_count": 404
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2026-04-25T15:15:26.186132400Z",
|
||||||
|
"start_time": "2026-04-25T15:15:26.176807100Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cell_type": "code",
|
||||||
|
"source": [
|
||||||
|
"for feature in features_to_test:\n",
|
||||||
|
" X_single = df_encoded[[feature]]"
|
||||||
|
],
|
||||||
|
"id": "3f65e25b63cc8e93",
|
||||||
|
"outputs": [],
|
||||||
|
"execution_count": 407
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2026-04-25T15:15:37.813266600Z",
|
||||||
|
"start_time": "2026-04-25T15:15:37.797080500Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cell_type": "code",
|
||||||
|
"source": "X_train_s, X_test_s, y_train_s, y_test_s = train_test_split(X_single, y, test_size=0.3, random_state=101)",
|
||||||
|
"id": "213bcc196f94054d",
|
||||||
|
"outputs": [],
|
||||||
|
"execution_count": 408
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2026-04-25T15:15:59.633576900Z",
|
||||||
|
"start_time": "2026-04-25T15:15:59.612227200Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cell_type": "code",
|
||||||
|
"source": [
|
||||||
|
"simple_model = LinearRegression()\n",
|
||||||
|
"simple_model.fit(X_train_s, y_train_s)"
|
||||||
|
],
|
||||||
|
"id": "75e6c5289568ef2f",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"LinearRegression()"
|
||||||
|
],
|
||||||
|
"text/html": [
|
||||||
|
"<style>#sk-container-id-1 {\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",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1.light {\n",
|
||||||
|
" /* Specific color for light theme */\n",
|
||||||
|
" --sklearn-color-text-on-default-background: black;\n",
|
||||||
|
" --sklearn-color-background: white;\n",
|
||||||
|
" --sklearn-color-border-box: black;\n",
|
||||||
|
" --sklearn-color-icon: #696969;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1.dark {\n",
|
||||||
|
" --sklearn-color-text-on-default-background: white;\n",
|
||||||
|
" --sklearn-color-background: #111;\n",
|
||||||
|
" --sklearn-color-border-box: white;\n",
|
||||||
|
" --sklearn-color-icon: #878787;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1 {\n",
|
||||||
|
" color: var(--sklearn-color-text);\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1 pre {\n",
|
||||||
|
" padding: 0;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1 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-1 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-1 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-1 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-1 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-1 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-1 div.sk-parallel-item {\n",
|
||||||
|
" display: flex;\n",
|
||||||
|
" flex-direction: column;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1 div.sk-parallel-item:first-child::after {\n",
|
||||||
|
" align-self: flex-end;\n",
|
||||||
|
" width: 50%;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1 div.sk-parallel-item:last-child::after {\n",
|
||||||
|
" align-self: flex-start;\n",
|
||||||
|
" width: 50%;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1 div.sk-parallel-item:only-child::after {\n",
|
||||||
|
" width: 0;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"/* Serial-specific style estimator block */\n",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1 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-1 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-1 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: center;\n",
|
||||||
|
" justify-content: center;\n",
|
||||||
|
" gap: 0.5em;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1 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-1 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-1 label.sk-toggleable__label-arrow:hover:before {\n",
|
||||||
|
" color: var(--sklearn-color-text);\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"/* Toggleable content - dropdown */\n",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1 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-1 div.sk-toggleable__content.fitted {\n",
|
||||||
|
" /* fitted */\n",
|
||||||
|
" background-color: var(--sklearn-color-fitted-level-0);\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1 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-1 div.sk-toggleable__content.fitted pre {\n",
|
||||||
|
" /* unfitted */\n",
|
||||||
|
" background-color: var(--sklearn-color-fitted-level-0);\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1 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-1 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-1 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-1 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-1 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-1 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-1 div.sk-label label.sk-toggleable__label,\n",
|
||||||
|
"#sk-container-id-1 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-1 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-1 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-1 div.sk-label label {\n",
|
||||||
|
" font-family: monospace;\n",
|
||||||
|
" font-weight: bold;\n",
|
||||||
|
" line-height: 1.2em;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1 div.sk-label-container {\n",
|
||||||
|
" text-align: center;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"/* Estimator-specific */\n",
|
||||||
|
"#sk-container-id-1 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-1 div.sk-estimator.fitted {\n",
|
||||||
|
" /* fitted */\n",
|
||||||
|
" background-color: var(--sklearn-color-fitted-level-0);\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"/* on hover */\n",
|
||||||
|
"#sk-container-id-1 div.sk-estimator:hover {\n",
|
||||||
|
" /* unfitted */\n",
|
||||||
|
" background-color: var(--sklearn-color-unfitted-level-2);\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"#sk-container-id-1 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-unfitted-level-0);\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-3) 1pt solid;\n",
|
||||||
|
" color: var(--sklearn-color-unfitted-level-3);\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",
|
||||||
|
" background-color: var(--sklearn-color-fitted-level-0);\n",
|
||||||
|
" border: var(--sklearn-color-fitted-level-3) 1pt solid;\n",
|
||||||
|
" color: var(--sklearn-color-fitted-level-3);\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",
|
||||||
|
" border: var(--sklearn-color-fitted-level-0) 1pt solid;\n",
|
||||||
|
" color: var(--sklearn-color-unfitted-level-0);\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",
|
||||||
|
" border: var(--sklearn-color-fitted-level-0) 1pt solid;\n",
|
||||||
|
" color: var(--sklearn-color-fitted-level-0);\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-1 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-unfitted-level-0);\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-1 a.estimator_doc_link.fitted {\n",
|
||||||
|
" /* fitted */\n",
|
||||||
|
" background-color: var(--sklearn-color-fitted-level-0);\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-1 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-1 a.estimator_doc_link.fitted:hover {\n",
|
||||||
|
" /* fitted */\n",
|
||||||
|
" background-color: var(--sklearn-color-fitted-level-3);\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
".estimator-table {\n",
|
||||||
|
" font-family: monospace;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
".estimator-table summary {\n",
|
||||||
|
" padding: .5rem;\n",
|
||||||
|
" cursor: pointer;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
".estimator-table summary::marker {\n",
|
||||||
|
" font-size: 0.7rem;\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",
|
||||||
|
" margin-top: 0;\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",
|
||||||
|
"/*\n",
|
||||||
|
" `table td`is set in notebook with right text-align.\n",
|
||||||
|
" We need to overwrite it.\n",
|
||||||
|
"*/\n",
|
||||||
|
".estimator-table table td.param {\n",
|
||||||
|
" text-align: left;\n",
|
||||||
|
" position: relative;\n",
|
||||||
|
" padding: 0;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
".user-set td {\n",
|
||||||
|
" color:rgb(255, 94, 0);\n",
|
||||||
|
" text-align: left !important;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
".user-set td.value {\n",
|
||||||
|
" color:rgb(255, 94, 0);\n",
|
||||||
|
" background-color: transparent;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
".default td {\n",
|
||||||
|
" color: black;\n",
|
||||||
|
" text-align: left !important;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
".user-set td i,\n",
|
||||||
|
".default td i {\n",
|
||||||
|
" color: black;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"/*\n",
|
||||||
|
" Styles for parameter documentation links\n",
|
||||||
|
" We need styling for visited so jupyter doesn't overwrite it\n",
|
||||||
|
"*/\n",
|
||||||
|
"a.param-doc-link,\n",
|
||||||
|
"a.param-doc-link:link,\n",
|
||||||
|
"a.param-doc-link:visited {\n",
|
||||||
|
" text-decoration: underline dashed;\n",
|
||||||
|
" text-underline-offset: .3em;\n",
|
||||||
|
" color: inherit;\n",
|
||||||
|
" display: block;\n",
|
||||||
|
" padding: .5em;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"/* \"hack\" to make the entire area of the cell containing the link clickable */\n",
|
||||||
|
"a.param-doc-link::before {\n",
|
||||||
|
" position: absolute;\n",
|
||||||
|
" content: \"\";\n",
|
||||||
|
" inset: 0;\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
".param-doc-description {\n",
|
||||||
|
" display: none;\n",
|
||||||
|
" position: absolute;\n",
|
||||||
|
" z-index: 9999;\n",
|
||||||
|
" left: 0;\n",
|
||||||
|
" padding: .5ex;\n",
|
||||||
|
" margin-left: 1.5em;\n",
|
||||||
|
" color: var(--sklearn-color-text);\n",
|
||||||
|
" box-shadow: .3em .3em .4em #999;\n",
|
||||||
|
" width: max-content;\n",
|
||||||
|
" text-align: left;\n",
|
||||||
|
" max-height: 10em;\n",
|
||||||
|
" overflow-y: auto;\n",
|
||||||
|
"\n",
|
||||||
|
" /* unfitted */\n",
|
||||||
|
" background: var(--sklearn-color-unfitted-level-0);\n",
|
||||||
|
" border: thin solid var(--sklearn-color-unfitted-level-3);\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"/* Fitted state for parameter tooltips */\n",
|
||||||
|
".fitted .param-doc-description {\n",
|
||||||
|
" /* fitted */\n",
|
||||||
|
" background: var(--sklearn-color-fitted-level-0);\n",
|
||||||
|
" border: thin solid var(--sklearn-color-fitted-level-3);\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
".param-doc-link:hover .param-doc-description {\n",
|
||||||
|
" display: block;\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-1\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>LinearRegression()</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-1\" type=\"checkbox\" checked><label for=\"sk-estimator-id-1\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>LinearRegression</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.8/modules/generated/sklearn.linear_model.LinearRegression.html\">?<span>Documentation for LinearRegression</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('fit_intercept',\n",
|
||||||
|
" this.parentElement.nextElementSibling)\"\n",
|
||||||
|
" ></i></td>\n",
|
||||||
|
" <td class=\"param\">\n",
|
||||||
|
" <a class=\"param-doc-link\"\n",
|
||||||
|
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.8/modules/generated/sklearn.linear_model.LinearRegression.html#:~:text=fit_intercept,-bool%2C%20default%3DTrue\">\n",
|
||||||
|
" fit_intercept\n",
|
||||||
|
" <span class=\"param-doc-description\">fit_intercept: bool, default=True<br><br>Whether to calculate the intercept for this model. If set<br>to False, no intercept will be used in calculations<br>(i.e. data is expected to be centered).</span>\n",
|
||||||
|
" </a>\n",
|
||||||
|
" </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('copy_X',\n",
|
||||||
|
" this.parentElement.nextElementSibling)\"\n",
|
||||||
|
" ></i></td>\n",
|
||||||
|
" <td class=\"param\">\n",
|
||||||
|
" <a class=\"param-doc-link\"\n",
|
||||||
|
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.8/modules/generated/sklearn.linear_model.LinearRegression.html#:~:text=copy_X,-bool%2C%20default%3DTrue\">\n",
|
||||||
|
" copy_X\n",
|
||||||
|
" <span class=\"param-doc-description\">copy_X: bool, default=True<br><br>If True, X will be copied; else, it may be overwritten.</span>\n",
|
||||||
|
" </a>\n",
|
||||||
|
" </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('tol',\n",
|
||||||
|
" this.parentElement.nextElementSibling)\"\n",
|
||||||
|
" ></i></td>\n",
|
||||||
|
" <td class=\"param\">\n",
|
||||||
|
" <a class=\"param-doc-link\"\n",
|
||||||
|
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.8/modules/generated/sklearn.linear_model.LinearRegression.html#:~:text=tol,-float%2C%20default%3D1e-6\">\n",
|
||||||
|
" tol\n",
|
||||||
|
" <span class=\"param-doc-description\">tol: float, default=1e-6<br><br>The precision of the solution (`coef_`) is determined by `tol` which<br>specifies a different convergence criterion for the `lsqr` solver.<br>`tol` is set as `atol` and `btol` of :func:`scipy.sparse.linalg.lsqr` when<br>fitting on sparse training data. This parameter has no effect when fitting<br>on dense data.<br><br>.. versionadded:: 1.7</span>\n",
|
||||||
|
" </a>\n",
|
||||||
|
" </td>\n",
|
||||||
|
" <td class=\"value\">1e-06</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",
|
||||||
|
" <a class=\"param-doc-link\"\n",
|
||||||
|
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.8/modules/generated/sklearn.linear_model.LinearRegression.html#:~:text=n_jobs,-int%2C%20default%3DNone\">\n",
|
||||||
|
" n_jobs\n",
|
||||||
|
" <span class=\"param-doc-description\">n_jobs: int, default=None<br><br>The number of jobs to use for the computation. This will only provide<br>speedup in case of sufficiently large problems, that is if firstly<br>`n_targets > 1` and secondly `X` is sparse or if `positive` is set<br>to `True`. ``None`` means 1 unless in a<br>:obj:`joblib.parallel_backend` context. ``-1`` means using all<br>processors. See :term:`Glossary <n_jobs>` for more details.</span>\n",
|
||||||
|
" </a>\n",
|
||||||
|
" </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('positive',\n",
|
||||||
|
" this.parentElement.nextElementSibling)\"\n",
|
||||||
|
" ></i></td>\n",
|
||||||
|
" <td class=\"param\">\n",
|
||||||
|
" <a class=\"param-doc-link\"\n",
|
||||||
|
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.8/modules/generated/sklearn.linear_model.LinearRegression.html#:~:text=positive,-bool%2C%20default%3DFalse\">\n",
|
||||||
|
" positive\n",
|
||||||
|
" <span class=\"param-doc-description\">positive: bool, default=False<br><br>When set to ``True``, forces the coefficients to be positive. This<br>option is only supported for dense arrays.<br><br>For a comparison between a linear regression model with positive constraints<br>on the regression coefficients and a linear regression without such constraints,<br>see :ref:`sphx_glr_auto_examples_linear_model_plot_nnls.py`.<br><br>.. versionadded:: 0.24</span>\n",
|
||||||
|
" </a>\n",
|
||||||
|
" </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('.copy-paste-icon').forEach(function(element) {\n",
|
||||||
|
" const toggleableContent = element.closest('.sk-toggleable__content');\n",
|
||||||
|
" const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n",
|
||||||
|
" const paramName = element.parentElement.nextElementSibling\n",
|
||||||
|
" .textContent.trim().split(' ')[0];\n",
|
||||||
|
" const fullParamName = paramPrefix ? `${paramPrefix}${paramName}` : paramName;\n",
|
||||||
|
"\n",
|
||||||
|
" element.setAttribute('title', fullParamName);\n",
|
||||||
|
"});\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"/**\n",
|
||||||
|
" * Adapted from Skrub\n",
|
||||||
|
" * https://github.com/skrub-data/skrub/blob/403466d1d5d4dc76a7ef569b3f8228db59a31dc3/skrub/_reporting/_data/templates/report.js#L789\n",
|
||||||
|
" * @returns \"light\" or \"dark\"\n",
|
||||||
|
" */\n",
|
||||||
|
"function detectTheme(element) {\n",
|
||||||
|
" const body = document.querySelector('body');\n",
|
||||||
|
"\n",
|
||||||
|
" // Check VSCode theme\n",
|
||||||
|
" const themeKindAttr = body.getAttribute('data-vscode-theme-kind');\n",
|
||||||
|
" const themeNameAttr = body.getAttribute('data-vscode-theme-name');\n",
|
||||||
|
"\n",
|
||||||
|
" if (themeKindAttr && themeNameAttr) {\n",
|
||||||
|
" const themeKind = themeKindAttr.toLowerCase();\n",
|
||||||
|
" const themeName = themeNameAttr.toLowerCase();\n",
|
||||||
|
"\n",
|
||||||
|
" if (themeKind.includes(\"dark\") || themeName.includes(\"dark\")) {\n",
|
||||||
|
" return \"dark\";\n",
|
||||||
|
" }\n",
|
||||||
|
" if (themeKind.includes(\"light\") || themeName.includes(\"light\")) {\n",
|
||||||
|
" return \"light\";\n",
|
||||||
|
" }\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" // Check Jupyter theme\n",
|
||||||
|
" if (body.getAttribute('data-jp-theme-light') === 'false') {\n",
|
||||||
|
" return 'dark';\n",
|
||||||
|
" } else if (body.getAttribute('data-jp-theme-light') === 'true') {\n",
|
||||||
|
" return 'light';\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" // Guess based on a parent element's color\n",
|
||||||
|
" const color = window.getComputedStyle(element.parentNode, null).getPropertyValue('color');\n",
|
||||||
|
" const match = color.match(/^rgb\\s*\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)\\s*$/i);\n",
|
||||||
|
" if (match) {\n",
|
||||||
|
" const [r, g, b] = [\n",
|
||||||
|
" parseFloat(match[1]),\n",
|
||||||
|
" parseFloat(match[2]),\n",
|
||||||
|
" parseFloat(match[3])\n",
|
||||||
|
" ];\n",
|
||||||
|
"\n",
|
||||||
|
" // https://en.wikipedia.org/wiki/HSL_and_HSV#Lightness\n",
|
||||||
|
" const luma = 0.299 * r + 0.587 * g + 0.114 * b;\n",
|
||||||
|
"\n",
|
||||||
|
" if (luma > 180) {\n",
|
||||||
|
" // If the text is very bright we have a dark theme\n",
|
||||||
|
" return 'dark';\n",
|
||||||
|
" }\n",
|
||||||
|
" if (luma < 75) {\n",
|
||||||
|
" // If the text is very dark we have a light theme\n",
|
||||||
|
" return 'light';\n",
|
||||||
|
" }\n",
|
||||||
|
" // Otherwise fall back to the next heuristic.\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" // Fallback to system preference\n",
|
||||||
|
" return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"function forceTheme(elementId) {\n",
|
||||||
|
" const estimatorElement = document.querySelector(`#${elementId}`);\n",
|
||||||
|
" if (estimatorElement === null) {\n",
|
||||||
|
" console.error(`Element with id ${elementId} not found.`);\n",
|
||||||
|
" } else {\n",
|
||||||
|
" const theme = detectTheme(estimatorElement);\n",
|
||||||
|
" estimatorElement.classList.add(theme);\n",
|
||||||
|
" }\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"forceTheme('sk-container-id-1');</script></body>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 409,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"execution_count": 409
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2026-04-25T15:16:10.648492700Z",
|
||||||
|
"start_time": "2026-04-25T15:16:10.630533500Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cell_type": "code",
|
||||||
|
"source": [
|
||||||
|
"y_pred_s = simple_model.predict(X_test_s)\n",
|
||||||
|
"rmse = np.sqrt(mean_squared_error(y_test_s, y_pred_s))"
|
||||||
|
],
|
||||||
|
"id": "983db24d45054c97",
|
||||||
|
"outputs": [],
|
||||||
|
"execution_count": 410
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2026-04-25T15:16:25.585898300Z",
|
||||||
|
"start_time": "2026-04-25T15:16:25.549110800Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cell_type": "code",
|
||||||
|
"source": "print(f\"RMSE using ONLY '{feature}': {rmse}\")",
|
||||||
|
"id": "4cb7c407238e67c1",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"RMSE using ONLY 'Numeric Installs': 0.4179032096419041\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"execution_count": 411
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": "",
|
"source": "",
|
||||||
"id": "8e3d435421cb39d"
|
"id": "79c525159dd03465"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
|||||||
Reference in new issue
Block a user