Skip to content

Commit

Permalink
&alex-jg3 [DOC] anomaly and changepoint detection notebook from ODSC …
Browse files Browse the repository at this point in the history
…2024 (#7284)

This PR adds the notebook of @Alex-JG3 from ODSC 2024 on anomaly and
changepoint detection with `sktime` and `skchange` to the examples. This
is without the metrics section, as I expect that the metrics end state
will be different (i.e., following `BaseMetric` design).

Also makes the following changes:

* adds `skchange` to the dependencies installed for binder notebooks so
the code runs
* adds the data used to the data folder, without loaders - only a few
dozen kb, and without loaders for now
* changes some of the headers in other notebooks, so the auto-generated
thumbnail and link names are sensible
  • Loading branch information
fkiraly authored Oct 17, 2024
1 parent be4deb4 commit c392695
Show file tree
Hide file tree
Showing 9 changed files with 9,691 additions and 16 deletions.
1 change: 1 addition & 0 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Changepoint, Anomaly or Outlier Detection
.. nbgallery::
:glob:

examples/07_detection_anomaly_changepoints.ipynb
examples/annotation/*

Time series Distances, Kernels, Alignment
Expand Down
17 changes: 8 additions & 9 deletions examples/03_transformers.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Transformers in `sktime` <a class=\"anchor\" id=\"chapter3\"></a>"
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand Down Expand Up @@ -64,14 +71,6 @@
"---"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# 3. Transformers in `sktime` <a class=\"anchor\" id=\"chapter3\"></a>"
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand Down Expand Up @@ -5721,7 +5720,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.11.9"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
Expand Down
14 changes: 7 additions & 7 deletions examples/03b_forecasting_transformers_pipelines_tuning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# 4 Forecasting Pipelines, Tuning, and AutoML\n",
"# Forecasting Pipelines, Tuning, and AutoML\n",
"This notebook is about pipelining and tuning (grid search) for time series forecasting with `sktime`"
]
},
Expand All @@ -25,7 +25,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4.1 Using exogeneous data `X` in forecasting\n",
"## 1. Using exogeneous data `X` in forecasting\n",
"The exogenous data `X` is a `pd.DataFrame` with the same index as `y`. It can be given optionally to a forecaster in the `fit` and `predict` methods. If `X` is given in `fit`, it also has to be given in `predict`, this means the future values of `X` have to be available at the time of prediction. "
]
},
Expand Down Expand Up @@ -213,7 +213,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4.2 Simple Forecasting Pipelines\n",
"## 2. Simple Forecasting Pipelines\n",
"\n",
"We hae seen: pipelines combine multiple estimators into one.\n",
"\n",
Expand Down Expand Up @@ -432,7 +432,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4.3 Tuning"
"## 3. Tuning"
]
},
{
Expand Down Expand Up @@ -1587,7 +1587,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4.4 Putting it all together: AutoML-like pipeline and tuning\n",
"## 4. Putting it all together: AutoML-like pipeline and tuning\n",
"\n",
"Taking all incredients from above examples, we can build a forecaster that comes close to what is usually called [AutoML](https://en.wikipedia.org/wiki/Automated_machine_learning).\n",
"With AutoML we aim to automate as many steps of an ML model creation as possible. The main compositions from `sktime` that we can use for this are:\n",
Expand Down Expand Up @@ -1788,7 +1788,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4.5 Model backtesting\n",
"## 5. Model backtesting\n",
"\n",
"After fitting a model, we can evaluate the model error in the past similar to a cross-validation. For this we can use the `evaluate` function. This approach is often also called backtesting as we want to test the forecasters performance in the past."
]
Expand Down Expand Up @@ -2365,7 +2365,7 @@
"source": [
"---\n",
"\n",
"### Credits: notebook 4 - pipelines\n",
"### Credits: notebook - pipelines\n",
"\n",
"notebook creation: aiwalter\n",
"\n",
Expand Down
979 changes: 979 additions & 0 deletions examples/07_detection_anomaly_changepoints.ipynb

Large diffs are not rendered by default.

Binary file added examples/img/annotation_tree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ tests = [
binder = [
"jupyter",
"pandas<2.0.0",
"skchange<0.9.0",
]
cython_extras = [
"mrseql < 0.0.3",
Expand Down
Loading

0 comments on commit c392695

Please sign in to comment.