Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Please see [`tsml_eval`](https://github.com/time-series-machine-learning/tsml-ev
is more of a sandbox for testing out new ideas and algorithms. It may contain some
algorithms and implementations that are not available in the other toolkits.

The current release of `tsml` is v0.5.0.
The current release of `tsml` is v0.6.0.

## Installation

Expand Down
18 changes: 7 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "tsml"
version = "0.5.0"
version = "0.6.0"
description = "A development sandbox for time series machine learning algorithms."
authors = [
{name = "Matthew Middlehurst", email = "[email protected]"},
Expand Down Expand Up @@ -38,25 +38,21 @@ classifiers = [
"Programming Language :: Python :: 3.12",
]
dependencies = [
"numba>=0.55.0,<0.61.0",
"numpy>=1.21.0,<2.2.0",
"scipy>=1.9.0,<1.14.0",
"pandas>=1.5.3,<2.3.0",
"scikit-learn>=1.0.0,<1.4.0",
"numba>=0.55.0",
"numpy>=1.21.0",
"scipy>=1.9.0",
"pandas>=1.5.3",
"scikit-learn>=1.0.0",
"packaging>=20.0",
]

[project.optional-dependencies]
all_extras = [
"grailts",
"scikit-fda>=0.7.0",
"statsmodels>=0.12.1",
"stumpy>=1.6.0",
# "scikit-fda>=0.7.0",
"wildboar",
]
unstable_extras = [
"pycatch22",
"pyfftw>=0.12.0; python_version < '3.12'", # requires fftw to be installed for Windows and some other OS (see http://www.fftw.org/index.html)
"mrsqm>=0.0.7; platform_system == 'Linux' and python_version < '3.12'", # requires gcc and fftw to be installed for Windows and some other OS (see http://www.fftw.org/index.html)
"mrseql>=0.0.4,<0.1.0; platform_system == 'Linux' and python_version < '3.12'", # requires gcc and fftw to be installed for Windows and some other OS (see http://www.fftw.org/index.html)
]
Expand Down
2 changes: 1 addition & 1 deletion tsml/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""tsml."""

__version__ = "0.5.0"
__version__ = "0.6.0"
26 changes: 13 additions & 13 deletions tsml/compose/_channel_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,17 @@ class ChannelEnsembleClassifier(ClassifierMixin, _BaseChannelEnsemble):
Examples
--------
>>> from tsml.compose import ChannelEnsembleClassifier
>>> from tsml.interval_based import IntervalForestClassifier
>>> from tsml.dummy import DummyClassifier
>>> from tsml.utils.testing import generate_3d_test_data
>>> X, y = generate_3d_test_data(n_samples=8, series_length=10, random_state=0)
>>> reg = ChannelEnsembleClassifier(
... estimators=("tsf", IntervalForestClassifier(n_estimators=2), "all-split"),
... estimators=("d", DummyClassifier(), "all-split"),
... random_state=0,
... )
>>> reg.fit(X, y)
ChannelEnsembleClassifier(...)
>>> reg.predict(X)
array([0, 1, 1, 0, 0, 1, 0, 1])
array([0, 0, 0, 0, 0, 0, 0, 0])
"""

def __init__(self, estimators, remainder="drop", random_state=None):
Expand Down Expand Up @@ -349,12 +349,12 @@ def get_test_params(
params : dict or list of dict
Parameters to create testing instances of the class.
"""
from tsml.interval_based import IntervalForestClassifier
from tsml.dummy import DummyClassifier

return {
"estimators": [
("tsf1", IntervalForestClassifier(n_estimators=2), 0),
("tsf2", IntervalForestClassifier(n_estimators=2), 0),
("d1", DummyClassifier(), 0),
("d2", DummyClassifier(), 0),
]
}

Expand Down Expand Up @@ -411,19 +411,19 @@ class ChannelEnsembleRegressor(RegressorMixin, _BaseChannelEnsemble):
Examples
--------
>>> from tsml.compose import ChannelEnsembleRegressor
>>> from tsml.interval_based import IntervalForestRegressor
>>> from tsml.dummy import DummyRegressor
>>> from tsml.utils.testing import generate_3d_test_data
>>> X, y = generate_3d_test_data(n_samples=8, series_length=10,
... regression_target=True, random_state=0)
>>> reg = ChannelEnsembleRegressor(
... estimators=("tsf", IntervalForestRegressor(n_estimators=2), "all-split"),
... estimators=("d", DummyRegressor(), "all-split"),
... random_state=0,
... )
>>> reg.fit(X, y)
ChannelEnsembleRegressor(...)
>>> reg.predict(X)
array([0.31798318, 1.41426301, 1.06414747, 0.6924721 , 0.56660146,
1.26538944, 0.52324808, 1.0939405 ])
array([0.8672557, 0.8672557, 0.8672557, 0.8672557, 0.8672557, 0.8672557,
0.8672557, 0.8672557], dtype=float32)
"""

def __init__(self, estimators, remainder="drop", random_state=None):
Expand Down Expand Up @@ -518,12 +518,12 @@ def get_test_params(
params : dict or list of dict
Parameters to create testing instances of the class.
"""
from tsml.interval_based import IntervalForestRegressor
from tsml.dummy import DummyRegressor

return {
"estimators": [
("tsf1", IntervalForestRegressor(n_estimators=2), 0),
("tsf2", IntervalForestRegressor(n_estimators=2), 0),
("d1", DummyRegressor(), 0),
("d2", DummyRegressor(), 0),
]
}

Expand Down
26 changes: 9 additions & 17 deletions tsml/compose/tests/test_channel_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,21 @@
_check_key_type,
_get_channel,
)
from tsml.interval_based import IntervalForestClassifier, IntervalForestRegressor
from tsml.dummy import DummyClassifier, DummyRegressor
from tsml.utils.testing import generate_3d_test_data, generate_unequal_test_data


def test_single_estimator():
"""Test that a single estimator is correctly applied to all channels."""
X, y = generate_3d_test_data(n_channels=3)

ens = ChannelEnsembleClassifier(
estimators=[("tsf", IntervalForestClassifier(n_estimators=2), "all")]
)
ens = ChannelEnsembleClassifier(estimators=[("d", DummyClassifier(), "all")])
ens.fit(X, y)

assert len(ens.estimators_[0][2]) == 3
assert ens.predict(X).shape == (X.shape[0],)

ens = ChannelEnsembleRegressor(
estimators=[("tsf", IntervalForestRegressor(n_estimators=2), "all")]
)
ens = ChannelEnsembleRegressor(estimators=[("d", DummyRegressor(), "all")])
ens.fit(X, y)

assert len(ens.estimators_[0][2]) == 3
Expand All @@ -38,18 +34,14 @@ def test_single_estimator_split():
"""Test that a single split estimator correctly creates an estimator per channel."""
X, y = generate_3d_test_data(n_channels=3)

ens = ChannelEnsembleClassifier(
estimators=("tsf", IntervalForestClassifier(n_estimators=2), "all-split")
)
ens = ChannelEnsembleClassifier(estimators=("d", DummyClassifier(), "all-split"))
ens.fit(X, y)

assert len(ens.estimators_) == 3
assert isinstance(ens.estimators_[0][2], int)
assert ens.predict(X).shape == (X.shape[0],)

ens = ChannelEnsembleRegressor(
estimators=("tsf", IntervalForestRegressor(n_estimators=2), "all-split")
)
ens = ChannelEnsembleRegressor(estimators=("d", DummyRegressor(), "all-split"))
ens.fit(X, y)

assert len(ens.estimators_) == 3
Expand All @@ -62,17 +54,17 @@ def test_remainder():
X, y = generate_3d_test_data(n_channels=3)

ens = ChannelEnsembleClassifier(
estimators=[("tsf", IntervalForestClassifier(n_estimators=2), 0)],
remainder=IntervalForestClassifier(n_estimators=2),
estimators=[("d", DummyClassifier(), 0)],
remainder=DummyClassifier(),
)
ens.fit(X, y)

assert len(ens._remainder[2]) == 2
assert ens.predict(X).shape == (X.shape[0],)

ens = ChannelEnsembleRegressor(
estimators=[("tsf", IntervalForestRegressor(n_estimators=2), 0)],
remainder=IntervalForestRegressor(n_estimators=2),
estimators=[("d", DummyRegressor(), 0)],
remainder=DummyRegressor(),
)
ens.fit(X, y)

Expand Down
7 changes: 0 additions & 7 deletions tsml/distances/__init__.py

This file was deleted.

66 changes: 0 additions & 66 deletions tsml/distances/_manhattan.py

This file was deleted.

21 changes: 0 additions & 21 deletions tsml/interval_based/__init__.py

This file was deleted.

Loading