Skip to content

Commit

Permalink
[DOC] update intro notebook with material from ISF and EuroSciPy 2024 (
Browse files Browse the repository at this point in the history
…#7013)

This PR updates the intro notebook with material from ISF 2024 and
EuroSciPy 2024, and more generally brings it to a more up-to-date and
consistent state.

* reformat most existing images to scale with width of text
* Updated "object and estimator types" table with links, add reference
to `skpro` for "time" relevant objects
* made basic example vignettes consistent with exposition slides in
section 2
* added feature summary and marketplace slides from @fkiraly's talk at
ISF 2024 to section 3
* added reference and link to estimator search in section 3

A few png are added for the slides in section 3.
  • Loading branch information
fkiraly authored Aug 27, 2024
1 parent 7eabd75 commit d0c294b
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 41 deletions.
135 changes: 94 additions & 41 deletions examples/00_sktime_intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"2. **Fit** the instance of your model\n",
"3. Use that fitted instance to **predict** new data!\n",
"\n",
"![](./img/estimator-conceptual-model.jpg)"
"<img src=\"./img/estimator-conceptual-model.jpg\" alt=\"Estimator conceptual model\" style=\"width: 100%; max-width: 600px;\">"
]
},
{
Expand Down Expand Up @@ -423,7 +423,8 @@
"= like a power plug adapter, it's plug&play if it conforms with the interface\n",
"\n",
"Pictorial summary:\n",
"![](./img/sklearn-unified-interface.jpg)"
"\n",
"<img src=\"./img/sklearn-unified-interface.jpg\" alt=\"Unified estimator interface\" style=\"width: 100%; max-width: 600px;\">"
]
},
{
Expand Down Expand Up @@ -498,54 +499,76 @@
"metadata": {},
"source": [
"| Task | Status | Links |\n",
"|------|--------|-------|\n",
"| **Forecasting** | stable |>>[Tutorial](https://www.sktime.net/en/latest/examples/01_forecasting.html) >> [API Reference](https://www.sktime.net/en/latest/api_reference/forecasting.html) >> [Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/forecasting.py)|\n",
"| **Time Series Classification** | stable |>>[Tutorial](https://github.com/sktime/sktime/blob/main/examples/02_classification.ipynb) >> [API Reference](https://www.sktime.net/en/latest/api_reference/classification.html) >> [Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/classification.py)|\n",
"| **Transformations** | stable |>>[Tutorial](https://github.com/sktime/sktime/blob/main/examples/03_transformers.ipynb) >> [API Reference](https://www.sktime.net/en/latest/api_reference/transformations.html) >> [Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/transformer.py)|\n",
"| **Parameter fitting** | maturing |>>[API Reference](https://www.sktime.net/en/latest/api_reference/param_est.html) >> [Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/transformer.py)|\n",
"| **Time Series Clustering** | maturing |>>[API Reference](https://www.sktime.net/en/latest/api_reference/clustering.html) >> [Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/clustering.py)|\n",
"| **Time Series Distances/Kernels** | maturing |>>[Tutorial](https://github.com/sktime/sktime/blob/main/examples/03_transformers.ipynb) >> [API Reference](https://www.sktime.net/en/latest/api_reference/dists_kernels.html) >> [Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/dist_kern_panel.py)|\n",
"| **Annotation** | experimental |>>[Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/annotation.py)|\n",
"|**Distributions and simulation** | experimental | None |"
"|---|---|---|\n",
"| **Forecasting** | stable | [Tutorial](https://www.sktime.net/en/latest/examples/01_forecasting.html) · [API Reference](https://www.sktime.net/en/latest/api_reference/forecasting.html) · [Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/forecasting.py) |\n",
"| **Time Series Classification** | stable | [Tutorial](https://github.com/sktime/sktime/blob/main/examples/02_classification.ipynb) · [API Reference](https://www.sktime.net/en/latest/api_reference/classification.html) · [Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/classification.py) |\n",
"| **Time Series Regression** | stable | [Tutorial](https://github.com/sktime/sktime/blob/main/examples/02_classification.ipynb) · [API Reference](https://www.sktime.net/en/latest/api_reference/regression.html) |\n",
"| **Transformations** | stable | [Tutorial](https://github.com/sktime/sktime/blob/main/examples/03_transformers.ipynb) · [API Reference](https://www.sktime.net/en/latest/api_reference/transformations.html) · [Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/transformer.py) |\n",
"| **Performance metrics for forecasts** | stable | [API Reference](https://www.sktime.net/en/latest/api_reference/performance_metrics.html) |\n",
"| **Time series splitting/resampling** | stable | [API Reference](https://www.sktime.net/en/latest/api_reference/split.html) |\n",
"| **Parameter fitting** | maturing | [API Reference](https://www.sktime.net/en/latest/api_reference/param_est.html) · [Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/transformer.py) |\n",
"| **Time Series Alignment** | maturing | [API Reference](https://www.sktime.net/en/latest/api_reference/alignment.html) · [Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/alignment.py) |\n",
"| **Time Series Clustering** | maturing | [API Reference](https://www.sktime.net/en/latest/api_reference/clustering.html) · [Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/clustering.py) |\n",
"| **Time Series Distances/Kernels** | maturing | [Tutorial](https://github.com/sktime/sktime/blob/main/examples/03_transformers.ipynb) · [API Reference](https://www.sktime.net/en/latest/api_reference/dists_kernels.html) · [Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/dist_kern_panel.py) |\n",
"| **Anomalies, changepoints** | experimental | [Extension Template](https://github.com/sktime/sktime/blob/main/extension_templates/annotation.py) |\n",
"\n",
"In the [skpro](https://github.com/sktime/skpro) companion package:\n",
"\n",
"| Module | Status | Links |\n",
"|---|---|---|\n",
"| **Probabilistic tabular regression** | maturing | [Tutorial](https://github.com/sktime/skpro/blob/main/examples/01_skpro_intro.ipynb) · [API Reference](https://skpro.readthedocs.io/en/latest/api_reference/regression.html) · [Extension Template](https://github.com/sktime/skpro/blob/main/extension_templates/regression.py) |\n",
"| **Time-to-event (survival) prediction** | maturing | [Tutorial](https://github.com/sktime/skpro/blob/main/examples/02_skpro_survival.ipynb) · [API Reference](https://skpro.readthedocs.io/en/latest/api_reference/survival.html) · [Extension Template](https://github.com/sktime/skpro/blob/main/extension_templates/survival.py) |\n",
"| **Performance metrics for proba predictions** | maturing | [API Reference](https://skpro.readthedocs.io/en/latest/api_reference/metrics.html) |\n",
"| **Probability distributions** | maturing | [Tutorial](https://github.com/sktime/skpro/blob/main/examples/03_skpro_distributions.ipynb) · [API Reference](https://skpro.readthedocs.io/en/latest/api_reference/distributions.html) · [Extension Template](https://github.com/sktime/skpro/blob/main/extension_templates/distributions.py) |\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Some examples below - details in the respective module introduction notebooks!**"
"### Example - forecasting"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Example - forecasting"
"<img src=\"./img/forecasting.png\" alt=\"Forecasting\" style=\"width: 100%; max-width: 600px;\">"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# get the data\n",
"from sktime.datasets import load_airline\n",
"from sktime.forecasting.naive import NaiveForecaster\n",
"\n",
"# step 1: data specification\n",
"y = load_airline()\n",
"y = load_airline()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
"# step 2: specifying forecasting horizon\n",
"fh = range(1, 37)\n",
"from sktime.forecasting.naive import NaiveForecaster\n",
"\n",
"# step 3: specifying the forecasting algorithm\n",
"# step 1: specify the forecasting algorithm\n",
"forecaster = NaiveForecaster(strategy=\"last\", sp=12)\n",
"\n",
"# step 4: fitting the forecaster\n",
"forecaster.fit(y)\n",
"# step 2: specify forecasting horizon\n",
"fh = np.arange(1, 37) # we want to predict the next 36 months\n",
"\n",
"# step 5: querying predictions\n",
"y_pred = forecaster.predict(fh)"
"# step 3: fit the forecaster\n",
"forecaster.fit(y, fh=fh)\n",
"\n",
"# step 4: make the forecast\n",
"y_pred = forecaster.predict()"
]
},
{
Expand Down Expand Up @@ -574,7 +597,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Example - classification"
"### Example - time series classification"
]
},
{
Expand All @@ -586,30 +609,39 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from sktime.classification.distance_based import KNeighborsTimeSeriesClassifier\n",
"# get the data\n",
"from sktime.datasets import load_osuleaf\n",
"from sktime.dists_kernels import ScipyDist\n",
"from sktime.dists_kernels.compose_tab_to_panel import FlatDist\n",
"\n",
"# step 1 - specify training data\n",
"# for training\n",
"X_train, y_train = load_osuleaf(split=\"train\", return_type=\"numpy3D\")\n",
"\n",
"# step 2 - specify data to predict labels for\n",
"# for prediction\n",
"X_new, _ = load_osuleaf(split=\"test\", return_type=\"numpy3D\")\n",
"X_new = X_new[:2]\n",
"X_new = X_new[:2]"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"from sktime.classification.distance_based import KNeighborsTimeSeriesClassifier\n",
"from sktime.dists_kernels import ScipyDist\n",
"from sktime.dists_kernels.compose_tab_to_panel import AggrDist\n",
"\n",
"# step 3 - specify the classifier\n",
"mean_eucl_dist = FlatDist(ScipyDist())\n",
"# step 1 - specify the classifier\n",
"mean_eucl_dist = AggrDist(ScipyDist())\n",
"clf = KNeighborsTimeSeriesClassifier(n_neighbors=3, distance=mean_eucl_dist)\n",
"\n",
"# step 4 - fitting the classifier\n",
"# step 2 - fit the classifier\n",
"clf.fit(X_train, y_train)\n",
"\n",
"# step 5 - predict labels on new data\n",
"# step 3 - predict labels on new data\n",
"y_pred = clf.predict(X_new)"
]
},
Expand Down Expand Up @@ -703,15 +735,36 @@
"\n",
"- lots of great implementations and methods out there!\n",
"- but many different interfaces, not composable like `sklearn`\n",
"\n",
"<img src=\"./img/ts-fragmentation.png\" alt=\"The fragmented time series ecosystem\" style=\"width: 100%; max-width: 600px;\">"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"`sktime` integrates the ecosystem - in friendly collaboration with all the packages out there!\n",
"\n",
"- unified interface standard\n",
"- highly composable\n",
"- mini-package manager on estiator/module level\n",
"- easily extensible - 3rd party plugins, other packages\n",
"<img src=\"./img/sktime-interoperable.png\" alt=\"sktime integration\" style=\"width: 100%; max-width: 600px;\">"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src=\"./img/sktime-composable.png\" alt=\"sktime composition\" style=\"width: 100%; max-width: 600px;\">"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"easy search for plug&play components across the ecosystem!\n",
"\n",
"Try the [`sktime` estimator search](https://www.sktime.net/en/latest/estimator_overview.html)\n",
"\n",
"![](./img/unified_framework.png)"
"<img src=\"./img/estimator-search.png\" alt=\"sktime estimator search\" style=\"width: 100%; max-width: 600px;\">"
]
},
{
Expand Down
Binary file added examples/img/estimator-search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/img/sktime-composable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/img/sktime-doc-estimator-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/img/sktime-interoperable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/img/ts-fragmentation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d0c294b

Please sign in to comment.