Skip to content

Commit cd1b776

Browse files
fixes
1 parent c7d080f commit cd1b776

File tree

6 files changed

+50
-24
lines changed

6 files changed

+50
-24
lines changed

.codecov.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ coverage:
1616
# post comment on PR
1717
comment: false
1818

19+
# enable codecov to report to GitHub status checks
20+
github_checks:
21+
annotations: false
22+
1923
# ignore files
2024
ignore:
2125
- ".github/"

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
3939

4040
project = "tsml"
41-
copyright = "2022 - 2023, The tsml developers (BSD-3 License)"
41+
copyright = "The tsml developers (BSD-3 License)"
4242
author = "Matthew Middlehurst"
4343

4444

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "tsml"
7-
version = "0.0.1"
7+
version = "0.0.2"
88
description = "A toolkit for time series machine learning algorithms."
99
authors = [
1010
{name = "Matthew Middlehurst", email = "m.middlehurst@uea.ac.uk"},

tsml/datasets/_data_io.py

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ def load_from_ts_file(
5858
Examples
5959
--------
6060
>>> from tsml.datasets import load_from_ts_file
61-
>>> X, y = load_from_ts_file("MinimalChinatown/MinimalChinatown_TRAIN.ts")
61+
>>> path = (
62+
... "MinimalChinatown/MinimalChinatown_TRAIN.ts"
63+
... if os.path.exists("MinimalChinatown/MinimalChinatown_TRAIN.ts") else
64+
... "tsml/datasets/MinimalChinatown/MinimalChinatown_TRAIN.ts"
65+
... )
66+
>>> X, y = load_from_ts_file(path)
6267
"""
6368
# Initialize flags and variables used when parsing the file
6469
timestamps = False
@@ -100,7 +105,8 @@ def load_from_ts_file(
100105
tokens = line.split(" ")
101106
if len(tokens) == 1:
102107
raise IOError(
103-
"Invalid .ts file. @problemname tag requires str value (the problems name)."
108+
"Invalid .ts file. @problemname tag requires str value "
109+
"(the problems name)."
104110
)
105111
elif line.startswith("@timestamps"):
106112
tokens = line.split(" ")
@@ -154,14 +160,16 @@ def load_from_ts_file(
154160
tokens = line.split(" ")
155161
if len(tokens) != 2:
156162
raise IOError(
157-
"Invalid .ts file. @dimension tag requires a int value (the number of dimensions for the problem)."
163+
"Invalid .ts file. @dimension tag requires a int value "
164+
"(the number of dimensions for the problem)."
158165
)
159166

160167
try:
161168
dimensions = int(tokens[1])
162169
except ValueError:
163170
raise IOError(
164-
"Invalid .ts file. @dimension tag requires a int value (the number of dimensions for the problem)."
171+
"Invalid .ts file. @dimension tag requires a int value "
172+
"(the number of dimensions for the problem)."
165173
)
166174

167175
dimensions_tag = True
@@ -185,21 +193,24 @@ def load_from_ts_file(
185193
tokens = line.split(" ")
186194
if len(tokens) != 2:
187195
raise IOError(
188-
"Invalid .ts file. @serieslength tag requires a int value (the number of dimensions for the problem)."
196+
"Invalid .ts file. @serieslength tag requires a int value "
197+
"(the number of dimensions for the problem)."
189198
)
190199

191200
try:
192201
serieslength = int(tokens[1])
193202
except ValueError:
194203
raise IOError(
195-
"Invalid .ts file. @serieslength tag requires a int value (the number of dimensions for the problem)."
204+
"Invalid .ts file. @serieslength tag requires a int value "
205+
"(the number of dimensions for the problem)."
196206
)
197207

198208
serieslength_tag = True
199209
elif line.startswith("@targetlabel"):
200210
if classlabels_tag:
201211
raise IOError(
202-
"Invalid .ts file. @targetlabel tag cannot be used with @classlabel tag."
212+
"Invalid .ts file. @targetlabel tag cannot be used with "
213+
"@classlabel tag."
203214
)
204215

205216
tokens = line.split(" ")
@@ -219,14 +230,16 @@ def load_from_ts_file(
219230

220231
if token_len > 2:
221232
raise IOError(
222-
f"Invalid .ts file. @targetlabel tag should not be accompanied with info apart from True/False, but found {tokens}."
233+
f"Invalid .ts file. @targetlabel tag should not be accompanied "
234+
f"with info apart from True/False, but found {tokens}."
223235
)
224236

225237
targetlabels_tag = True
226238
elif line.startswith("@classlabel"):
227239
if targetlabels_tag:
228240
raise IOError(
229-
"Invalid .ts file. @classlabel tag cannot be used with @targetlabel tag."
241+
"Invalid .ts file. @classlabel tag cannot be used with "
242+
"@targetlabel tag."
230243
)
231244

232245
tokens = line.split(" ")
@@ -246,12 +259,14 @@ def load_from_ts_file(
246259

247260
if not classlabel and token_len > 2:
248261
raise IOError(
249-
f"Invalid .ts file. @classlabel tag should not be accompanied with additional info when False, but found {tokens}."
262+
f"Invalid .ts file. @classlabel tag should not be accompanied "
263+
f"with additional info when False, but found {tokens}."
250264
)
251265

252266
elif classlabel and token_len == 2:
253267
raise IOError(
254-
"Invalid .ts file. @classlabel tag is true but no Class values are supplied."
268+
"Invalid .ts file. @classlabel tag is true but no Class values "
269+
"are supplied."
255270
)
256271

257272
class_label_list = [token.strip() for token in tokens[2:]]
@@ -272,7 +287,8 @@ def load_from_ts_file(
272287

273288
if len(lines) == data_start_line + 1:
274289
raise IOError(
275-
"Invalid .ts file. A @data tag is present but no subsequent data is present."
290+
"Invalid .ts file. A @data tag is present but no subsequent data "
291+
"is present."
276292
)
277293
else:
278294
first_line = lines[data_start_line].split(":")
@@ -284,7 +300,8 @@ def load_from_ts_file(
284300
has_labels = classlabel
285301
else:
286302
raise IOError(
287-
"Unable to read .ts file. A @classlabel or @targetlabel tag is required."
303+
"Unable to read .ts file. A @classlabel or @targetlabel tag is "
304+
"required."
288305
)
289306

290307
# Equal length tag is required.
@@ -309,7 +326,8 @@ def load_from_ts_file(
309326
not timestamps_tag or (timestamps_tag and not timestamps)
310327
) and has_timestamps:
311328
raise IOError(
312-
"Value mismatch in .ts file. @timestamps tag is missing or False but data has timestamps. Timestamps are currently not supported."
329+
"Value mismatch in .ts file. @timestamps tag is missing or False "
330+
"but data has timestamps. Timestamps are currently not supported."
313331
)
314332
elif has_timestamps:
315333
raise IOError(
@@ -322,17 +340,20 @@ def load_from_ts_file(
322340
not univariate_tag or (univariate_tag and univariate)
323341
) and data_dims > 1:
324342
raise IOError(
325-
"Value mismatch in .ts file. @univariate tag is missing or True but data has more than one dimension."
343+
"Value mismatch in .ts file. @univariate tag is missing or True "
344+
"but data has more than one dimension."
326345
)
327346

328347
if dimensions_tag and dimensions != data_dims:
329348
raise IOError(
330-
f"Value mismatch in .ts file. @dimensions tag value {dimensions} and read number of dimensions {data_dims} do not match."
349+
f"Value mismatch in .ts file. @dimensions tag value {dimensions} "
350+
f"and read number of dimensions {data_dims} do not match."
331351
)
332352

333353
if serieslength_tag and serieslength != data_length:
334354
raise IOError(
335-
f"Value mismatch in .ts file. @serieslength tag value {serieslength} and read series length {data_length} do not match."
355+
f"Value mismatch in .ts file. @serieslength tag value "
356+
f"{serieslength} and read series length {data_length} do not match."
336357
)
337358

338359
if equallength:
@@ -390,7 +411,8 @@ def load_from_ts_file(
390411

391412
if not data_started:
392413
raise IOError(
393-
"Invalid .ts file. File contains metadata but no @data tag to signal the start of data."
414+
"Invalid .ts file. File contains metadata but no @data tag to signal the "
415+
"start of data."
394416
)
395417

396418
if has_labels:

tsml/utils/numba_functions/general.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def unique_count(X: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
6060
else:
6161
counts[uc] += 1
6262
return unique[: uc + 1], counts[: uc + 1]
63-
return np.zeros(0, dtype=np.int32), np.zeros(0, dtype=np.int32)
63+
return np.zeros(0), np.zeros(0, dtype=np.int32)
6464

6565

6666
@njit(fastmath=True, cache=True)

tsml/utils/testing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def generate_test_estimators() -> list[BaseEstimator]:
3636
"""
3737
classes = all_estimators()
3838
estimators = []
39-
for i, c in enumerate(classes):
39+
for c in classes:
4040
m = getattr(c[1], "get_test_params", None)
4141
if callable(m):
4242
params = c[1].get_test_params()
@@ -81,10 +81,10 @@ def parametrize_with_checks(estimators: list[BaseEstimator]) -> Callable:
8181
Examples
8282
--------
8383
>>> from tsml.utils.testing import parametrize_with_checks
84-
>>> from tsml.interval_based import DrCIFRegressor
84+
>>> from tsml.interval_based import TSFRegressor
8585
>>> from tsml.sklearn import RotationForestClassifier
8686
>>> @parametrize_with_checks(
87-
... [DrCIFRegressor(), RotationForestClassifier()]
87+
... [TSFRegressor(), RotationForestClassifier()]
8888
... )
8989
... def test_sklearn_compatible_estimator(estimator, check):
9090
... check(estimator)

0 commit comments

Comments
 (0)