Skip to content

Commit

Permalink
Merge branch 'main' into warnings-config
Browse files Browse the repository at this point in the history
  • Loading branch information
fkiraly committed May 18, 2023
2 parents bf0adbc + 192a0d8 commit 932c1d6
Show file tree
Hide file tree
Showing 58 changed files with 1,956 additions and 521 deletions.
11 changes: 10 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -2156,6 +2156,15 @@
"contributions": [
"doc"
]
}
},
{
"login": "marrov",
"name": "Marc Rovira",
"avatar_url": "https://avatars.githubusercontent.com/u/54272586?v=4",
"profile": "https://github.com/marrov",
"contributions": [
"doc"
]
}
]
}
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,26 @@ jobs:
run: build_tools/run_examples.sh
shell: bash

test-nodevdeps:
needs: code-quality
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Install sktime and dependencies
run: |
python -m pip install .
- name: Run pytest-free tests
run: |
python sktime/_nopytest_tests.py
test-nosoftdeps:
needs: code-quality
runs-on: ubuntu-20.04
Expand Down
27 changes: 14 additions & 13 deletions CONTRIBUTORS.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a href="https://www.sktime.net"><img src="https://github.com/sktime/sktime/blob/main/docs/source/images/sktime-logo.jpg?raw=true)" width="175" align="right" /></a>
<a href="https://www.sktime.net"><img src="https://github.com/sktime/sktime/blob/main/docs/source/images/sktime-logo.svg" width="175" align="right" /></a>

# Welcome to sktime

Expand Down
2 changes: 1 addition & 1 deletion docs/source/about/artwork.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ High-quality logos are available in the `docs/source/images/ <https://github.com

The logos were designed by `Miguel Garcia Cabrera <https://www.flickr.com/photos/miguelgarciacabrera/>`_.

.. image:: ../images/sktime-logo-no-text.jpg
.. image:: ../images/sktime-logo-no-text.png
:align: center
13 changes: 12 additions & 1 deletion docs/source/api_reference/classification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,19 @@ Composition

ClassifierPipeline
ColumnEnsembleClassifier
ComposableTimeSeriesForestClassifier
SklearnClassifierPipeline

Ensembles
---------

.. currentmodule:: sktime.classification.ensemble

.. autosummary::
:toctree: auto_generated/
:template: class.rst

BaggingClassifier
ComposableTimeSeriesForestClassifier
WeightedEnsembleClassifier

Deep learning
Expand Down
2 changes: 2 additions & 0 deletions docs/source/api_reference/dists_kernels.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ Dynamic Time Warping Distances
Time warping distances can also be obtained by composing ``DistFromAligner`` with
a time warping aligner, see docstring of ``DistFromAligner``:

.. currentmodule:: sktime.dists_kernels.compose_from_align

.. autosummary::
:toctree: auto_generated/
:template: class.rst
Expand Down
1 change: 1 addition & 0 deletions docs/source/api_reference/forecasting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Use ``make_reduction`` for easy specification.
RecursiveTimeSeriesRegressionForecaster
DirRecTabularRegressionForecaster
DirRecTimeSeriesRegressionForecaster
YfromX

Naive forecasters
-----------------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
Binary file added docs/source/images/sktime-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
558 changes: 558 additions & 0 deletions docs/source/images/sktime-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ Welcome to sktime

A unified framework for machine learning with time series.

.. topic:: Applications for sktime internships 2023 open!

Application deadline is May 19.
`Apply here <https://github.com/sktime/mentoring/blob/main/internships/sktime2023.md>`_


Mission
=======

Expand Down
2 changes: 1 addition & 1 deletion examples/minirocket.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"source": [
"### 1.2 Load the Training Data\n",
"\n",
"For more details on the data set, see the [univariate time series classification notebook](https://github.com/sktime/sktime/blob/main/examples/02_classification_univariate.ipynb).\n",
"For more details on the data set, see the [univariate time series classification notebook](https://github.com/sktime/sktime/blob/main/examples/02_classification.ipynb).\n",
"\n",
"**Note**: Input time series must be *at least* of length 9. Pad shorter time series using, e.g., `PaddingTransformer` (`sktime.transformers.panel.padder`)."
]
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ dependencies = [
"deprecated>=1.2.13",
"numpy>=1.21.0,<1.25",
"pandas>=1.1.0,<2.0.0",
"packaging",
"scikit-base<0.5.0",
"scikit-learn>=0.24.0,<1.3.0",
"scipy<2.0.0,>=1.2.0",
Expand Down Expand Up @@ -79,9 +80,9 @@ all_extras = [
"statsmodels>=0.12.1",
"stumpy>=1.5.1; python_version < '3.11'",
"tbats>=1.1.0",
"tensorflow-probability; python_version < '3.11'",
"tensorflow-probability<0.20.0; python_version < '3.11'",
"tensorflow; python_version < '3.11'",
"tsfresh>=0.17.0; python_version < '3.10'",
"tsfresh>=0.17.0",
"tslearn>=0.5.2; python_version < '3.11'",
"xarray",
"seasonal",
Expand Down
9 changes: 9 additions & 0 deletions sktime/_nopytest_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
"""Tests to run without pytest, to check pytest isolation."""
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)

from sktime.registry import all_estimators

# all_estimators crawls all modules excepting pytest test files
# if it encounters an unisolated import, it will throw an exception
results = all_estimators()
3 changes: 1 addition & 2 deletions sktime/benchmarking/forecasting.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ def forecasting_validation(
"""
y = dataset_loader()
results = {}
scores_df = evaluate(forecaster=estimator, y=y, cv=cv_splitter, scoring=scorers)
for scorer in scorers:
scorer_name = scorer.name
# TODO re-write evaluate to allow multiple scorers, to avoid recomputation
scores_df = evaluate(forecaster=estimator, y=y, cv=cv_splitter, scoring=scorer)
for ix, row in scores_df.iterrows():
results[f"{scorer_name}_fold_{ix}_test"] = row[f"test_{scorer_name}"]
results[f"{scorer_name}_mean"] = scores_df[f"test_{scorer_name}"].mean()
Expand Down
71 changes: 44 additions & 27 deletions sktime/benchmarking/tests/test_forecasting.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,43 @@
from sktime.benchmarking import forecasting
from sktime.forecasting.model_selection import ExpandingWindowSplitter
from sktime.forecasting.naive import NaiveForecaster
from sktime.performance_metrics.forecasting import MeanSquaredPercentageError
from sktime.performance_metrics.forecasting import (
MeanAbsoluteError,
MeanAbsolutePercentageError,
MeanSquaredPercentageError,
)
from sktime.utils.validation._dependencies import _check_soft_dependencies

expected_results_df_1 = pd.DataFrame(
data={
"validation_id": "[dataset=data_loader_simple]_"
+ "[cv_splitter=ExpandingWindowSplitter]-v1",
"model_id": "NaiveForecaster-v1",
"MeanSquaredPercentageError_fold_0_test": 0.0,
"MeanSquaredPercentageError_fold_1_test": 0.111,
"MeanSquaredPercentageError_mean": 0.0555,
"MeanSquaredPercentageError_std": 0.0785,
},
index=[0],
)

expected_results_df_2 = pd.DataFrame(
data={
"validation_id": "[dataset=data_loader_simple]_"
+ "[cv_splitter=ExpandingWindowSplitter]-v1",
"model_id": "NaiveForecaster-v1",
"MeanAbsolutePercentageError_fold_0_test": 0.0,
"MeanAbsolutePercentageError_fold_1_test": 0.333,
"MeanAbsolutePercentageError_mean": 0.1666,
"MeanAbsolutePercentageError_std": 0.2357,
"MeanAbsoluteError_fold_0_test": 0.0,
"MeanAbsoluteError_fold_1_test": 1.0,
"MeanAbsoluteError_mean": 0.5,
"MeanAbsoluteError_std": 0.7071,
},
index=[0],
)


def data_loader_simple() -> pd.DataFrame:
"""Return simple data for use in testing."""
Expand All @@ -20,7 +54,14 @@ def data_loader_simple() -> pd.DataFrame:
not _check_soft_dependencies("kotsu", severity="none"),
reason="skip test if required soft dependencies not available",
)
def test_forecastingbenchmark(tmp_path):
@pytest.mark.parametrize(
"expected_results_df, scorers",
[
(expected_results_df_1, [MeanSquaredPercentageError()]),
(expected_results_df_2, [MeanAbsolutePercentageError(), MeanAbsoluteError()]),
],
)
def test_forecastingbenchmark(tmp_path, expected_results_df, scorers):
"""Test benchmarking a forecaster estimator."""
benchmark = forecasting.ForecastingBenchmark()

Expand All @@ -31,37 +72,13 @@ def test_forecastingbenchmark(tmp_path):
step_length=1,
fh=1,
)
benchmark.add_task(data_loader_simple, cv_splitter, [MeanSquaredPercentageError()])
benchmark.add_task(data_loader_simple, cv_splitter, scorers)

results_file = tmp_path / "results.csv"
results_df = benchmark.run(results_file)

results_df = results_df.drop(columns=["runtime_secs"])

expected_results_df = pd.DataFrame(
[
(
(
"[dataset=data_loader_simple]_"
"[cv_splitter=ExpandingWindowSplitter]-v1"
),
"NaiveForecaster-v1",
0.0,
0.111,
0.0555,
0.0785,
)
],
columns=[
"validation_id",
"model_id",
"MeanSquaredPercentageError_fold_0_test",
"MeanSquaredPercentageError_fold_1_test",
"MeanSquaredPercentageError_mean",
"MeanSquaredPercentageError_std",
],
)

pd.testing.assert_frame_equal(
expected_results_df, results_df, check_exact=False, atol=0, rtol=0.001
)
10 changes: 6 additions & 4 deletions sktime/classification/compose/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
]

from sktime.classification.compose._column_ensemble import ColumnEnsembleClassifier
from sktime.classification.compose._ensemble import (
ComposableTimeSeriesForestClassifier,
WeightedEnsembleClassifier,
)
from sktime.classification.compose._pipeline import (
ClassifierPipeline,
SklearnClassifierPipeline,
)

# 0.20.0 - remove this import
from sktime.classification.ensemble import (
ComposableTimeSeriesForestClassifier,
WeightedEnsembleClassifier,
)
7 changes: 3 additions & 4 deletions sktime/classification/deep_learning/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ class BaseDeepClassifier(BaseClassifier, ABC):
batch_size : int, default = 40
training batch size for the model
Arguments
---------
self.model = None
Attributes
----------
self.model_ - the fitted DL model
"""

_tags = {
Expand Down
Loading

0 comments on commit 932c1d6

Please sign in to comment.