Skip to content

Commit

Permalink
Add scikit-lego
Browse files Browse the repository at this point in the history
  • Loading branch information
baniasbaabe committed Apr 7, 2024
1 parent 6f3cf77 commit 65426f3
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions book/machinelearning/modeltraining.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1889,6 +1889,56 @@
"alpha = [0.05, 0.20]\n",
"y_pred, y_pis = mapie_regressor.predict(X_test, alpha=alpha)"
]
},
{
"cell_type": "markdown",
"id": "bc7f6fab",
"metadata": {},
"source": [
"## Extra Components For scikit-learn with `scikit-lego`"
]
},
{
"cell_type": "markdown",
"id": "29e041d4",
"metadata": {},
"source": [
"scikit-learn is one of the most popular ML libraries.\n",
"\n",
"While it's easy to write custom components, it would be nice to have all of them in a single place.\n",
"\n",
"`scikit-lego` is such a library which contains many custom components like:\n",
"\n",
"- `DebugPipeline`, which adds debug information to pipelines\n",
"- `ImbalancedLinearRegression` to punish over-/underestimation of a model\n",
"- `add_lags` to add lag values to a DataFrame\n",
"- `ZeroInflatedRegressor` which predicts zero or applies a regression based on a classifier\n",
"\n",
"and many more!"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f2c86d37",
"metadata": {},
"outputs": [],
"source": [
"from sklearn.preprocessing import StandardScaler\n",
"from sklearn.pipeline import Pipeline\n",
"from sklego.preprocessing import RandomAdder\n",
"from sklego.mixture import GMMClassifier\n",
"\n",
"...\n",
"\n",
"pipeline = Pipeline([\n",
" (\"scale\", StandardScaler()),\n",
" (\"random_noise\", RandomAdder()),\n",
" (\"model\", GMMClassifier())\n",
"])\n",
"\n",
"..."
]
}
],
"metadata": {
Expand Down

0 comments on commit 65426f3

Please sign in to comment.