Skip to content

Commit

Permalink
New estimators and data io fix (#8)
Browse files Browse the repository at this point in the history
* actually change python version

* dummy classifiers and sklearn lower bound change

* test fix

* test fix

* dev

* early sklearn version fixes

* all interval classifiers

* dummy and conversion bugfix

* version

* test

* testing update

* version

* pandas

* stop all workflows failing

* copy check

* new estimators and data loading fix

* new ver

* ci

* gcc

* only macos

* codecov check
  • Loading branch information
MatthewMiddlehurst authored May 1, 2023
1 parent 1dad889 commit beffd0c
Show file tree
Hide file tree
Showing 22 changed files with 12,838 additions and 281 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ jobs:

- if: matrix.os == 'windows-latest'
name: Windows install
run: python -m pip install "${env:WHEELNAME}[extras,dev]"
run: python -m pip install "${env:WHEELNAME}[dev,extras,unstable_extras]"
- if: matrix.os != 'windows-latest'
name: Unix install
run: python -m pip install "${{ env.WHEELNAME }}[extras,dev]"
run: python -m pip install "${{ env.WHEELNAME }}[dev,extras,unstable_extras]"

- name: Tests
run: python -m pytest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install
run: python -m pip install .[dev,extras]
run: python -m pip install .[dev,extras,unstable_extras]

- name: Tests
run: python -m pytest
Expand All @@ -63,7 +63,7 @@ jobs:
run: echo "NUMBA_DISABLE_JIT=1" >> $GITHUB_ENV

- name: Install
run: python -m pip install .[dev,extras]
run: python -m pip install .[dev,extras,unstable_extras]

- name: Tests
run: python -m pytest --cov=tsml --cov-report=xml
Expand Down
8 changes: 6 additions & 2 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.0.7"
version = "0.1.0"
description = "A toolkit for time series machine learning algorithms."
authors = [
{name = "Matthew Middlehurst", email = "[email protected]"},
Expand Down Expand Up @@ -43,9 +43,13 @@ dependencies = [

[project.optional-dependencies]
extras = [
"pycatch22>=0.4.2",
"pyfftw>=0.12.0",
"statsmodels>=0.12.1",
"wildboar>=1.1.0",
]
unstable_extras = [
"mrsqm>=0.0.1 ; platform_system == 'Darwin'", # requires gcc and fftw to be installed for Windows and some other OS (see http://www.fftw.org/index.html)
"pycatch22>=0.4.2", # Known to fail installation on some setups
]
dev = [
"pre-commit",
Expand Down
2 changes: 1 addition & 1 deletion tsml/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
"""tsml."""

__version__ = "0.0.7"
__version__ = "0.1.0"
28 changes: 16 additions & 12 deletions tsml/datasets/_data_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def load_from_ts_file(
data is unequal length, a list of 2D numpy arrays will be returned. If labels are
present, they will be returned as well as the data.
The only mandatory tags in the loaded file are @equallength and one of
@targetlabels or @classlabels. Other details can be inferred, though some error
checking will be done if they are present.
The only mandatory tags in the loaded file are one of @targetlabels or @classlabels.
Other details can be inferred, though some error checking will be done if they are
present.
Parameters
----------
Expand Down Expand Up @@ -304,11 +304,9 @@ def load_from_ts_file(
"required."
)

# Equal length tag is required.
# Assume equal length if no tag.
if not equallength_tag:
raise IOError(
"Unable to read .ts file. The @equallength tag is required."
)
equallength = True

n_instances = len(lines) - data_start_line
data_dims = len(first_line) - 1 if has_labels else len(first_line)
Expand Down Expand Up @@ -384,13 +382,19 @@ def load_from_ts_file(
)

dimensions = line[:data_dims]
if not equallength:
data_length = len(dimensions[0].strip().split(","))
split = dimensions[0].strip().split(",")
length = len(split)
if equallength and length != data_length:
raise IOError(
"Unable to read .ts file. Inconsistent number of channels."
f"Expected {data_dims} but read {read_dims} on line {data_idx}."
)

# Process the data for each channel
series = np.zeros((data_dims, data_length), dtype=X_dtype)
for i in range(data_dims):
series[i, :] = dimensions[i].strip().split(",")
series = np.zeros((data_dims, length), dtype=X_dtype)
series[0, :] = split
for n in range(1, data_dims):
series[n, :] = dimensions[n].strip().split(",")

X[data_idx] = series

Expand Down
2 changes: 2 additions & 0 deletions tsml/datasets/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
"""Testing for data loaders."""
Loading

0 comments on commit beffd0c

Please sign in to comment.