Skip to content

Commit 37ce9f4

Browse files
authored
release: v2.6.0 (#266)
release: v2.6.0
2 parents a54dcdb + a769620 commit 37ce9f4

33 files changed

+273
-413
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ repos:
1111
pass_filenames: false
1212
# ruff check (w/autofix)
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.1.3 # should match version in pyproject.toml
14+
rev: v0.8.4 # should match version in pyproject.toml
1515
hooks:
1616
- id: ruff
1717
args: [--fix, --exit-non-zero-on-fix]
1818
# ruff format
1919
- repo: https://github.com/astral-sh/ruff-pre-commit
20-
rev: v0.1.3 # should match version in pyproject.toml
20+
rev: v0.8.4 # should match version in pyproject.toml
2121
hooks:
2222
- id: ruff-format
2323
# # pydoclint - docstring formatting

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,17 @@ Nothing, initial release!
388388

389389
</details>
390390

391-
## [v2.5.0](https://github.com/eonu/sequentia/releases/tag/v2.5.0) - 2024-12-27
391+
## [v2.6.0](https://github.com/eonu/sequentia/releases/tag/v2.6.0) - 2024-12-30
392+
393+
### Bug Fixes
394+
395+
- enable `joblib.Parallel` memory mapping ([#262](https://github.com/eonu/sequentia/issues/262))
392396

393397
### Documentation
394398

395399
- update copyright notice ([#255](https://github.com/eonu/sequentia/issues/255))
400+
- fix `KNNRegressor.window` docstring typo ([#261](https://github.com/eonu/sequentia/issues/261))
401+
- update `README.md` features ([#265](https://github.com/eonu/sequentia/issues/265))
396402

397403
### Features
398404

@@ -402,6 +408,11 @@ Nothing, initial release!
402408
- add `model_selection` sub-package for hyper-parameters ([#257](https://github.com/eonu/sequentia/issues/257))
403409
- add model spec support to `HMMClassifier.__init__` ([#258](https://github.com/eonu/sequentia/issues/258))
404410
- add `HMMClassifier.fit` multiprocessing ([#259](https://github.com/eonu/sequentia/issues/259))
411+
- set `use_c=True` by default for `KNNClassifier`/`KNNRegressor` ([#263](https://github.com/eonu/sequentia/issues/263))
412+
413+
### Styling
414+
415+
- upgrade to `ruff` v0.8.4 and fix type hints ([#264](https://github.com/eonu/sequentia/issues/264))
405416

406417
## [v2.0.2](https://github.com/eonu/sequentia/releases/tag/v2.0.2) - 2024-04-13
407418

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Some examples of how Sequentia can be used on sequence data include:
5858

5959
- **Simplicity and interpretability**: Sequentia offers a limited set of machine learning algorithms, chosen specifically to be more interpretable and easier to configure than more complex alternatives such as recurrent neural networks and transformers, while maintaining a high level of effectiveness.
6060
- **Familiar and user-friendly**: To fit more seamlessly into the workflow of data science practitioners, Sequentia follows the ubiquitous Scikit-Learn API, providing a familiar model development process for many, as well as enabling wider access to the rapidly growing Scikit-Learn ecosystem.
61+
- **Speed**: Some algorithms offered by Sequentia naturally have restrictive runtime scaling, such as k-nearest neighbors. However, our implementation is
62+
optimized to the point of being multiple orders of magnitude faster than similar packages — see the [Benchmarks](#benchmarks) section for more information.
6163

6264
## Build Status
6365

@@ -82,7 +84,7 @@ effective inference algorithm.
8284
- [x] Sakoe–Chiba band global warping constraint
8385
- [x] Dependent and independent feature warping (DTWD/DTWI)
8486
- [x] Custom distance-weighted predictions
85-
- [x] Multi-processed predictions
87+
- [x] Multi-processed prediction
8688

8789
#### [Hidden Markov Models](https://sequentia.readthedocs.io/en/latest/sections/models/hmm/index.html) (via [`hmmlearn`](https://github.com/hmmlearn/hmmlearn))
8890

@@ -99,7 +101,7 @@ based on the provided training sequence data.
99101
- [x] Multivariate real-valued observations (modeled with Gaussian mixture emissions)
100102
- [x] Univariate categorical observations (modeled with discrete emissions)
101103
- [x] Linear, left-right and ergodic topologies
102-
- [x] Multi-processed predictions
104+
- [x] Multi-processed training and prediction
103105

104106
### Scikit-Learn compatibility
105107

@@ -157,7 +159,7 @@ All of the above libraries support multiprocessing, and prediction was performed
157159
<img src="benchmarks/benchmark.svg" width="100%"/>
158160

159161
> **Device information**:
160-
> - Product: ThinkPad T14s (Gen 6)
162+
> - Product: Lenovo ThinkPad T14s (Gen 6)
161163
> - Processor: AMD Ryzen™ AI 7 PRO 360 (8 cores, 16 threads, 2-5GHz)
162164
> - Memory: 64 GB LPDDR5X-7500MHz
163165
> - Solid State Drive: 1 TB SSD M.2 2280 PCIe Gen4 Performance TLC Opal
@@ -175,7 +177,7 @@ pip install sequentia
175177

176178
For optimal performance when using any of the k-NN based models, it is important that the correct `dtaidistance` C libraries are accessible.
177179

178-
Please see the [`dtaidistance` installation guide](https://dtaidistance.readthedocs.io/en/latest/usage/installation.html) for troubleshooting if you run into C compilation issues, or if setting `use_c=True` on k-NN based models results in a warning.
180+
Please see the [`dtaidistance` installation guide](https://dtaidistance.readthedocs.io/en/latest/usage/installation.html) for troubleshooting if you run into C compilation issues, or if using k-NN based models with `use_c=True` results in a warning.
179181

180182
You can use the following to check if the appropriate C libraries are available.
181183

@@ -184,6 +186,8 @@ from dtaidistance import dtw
184186
dtw.try_import_c()
185187
```
186188

189+
If these libraries are unavailable, Sequentia will fall back to using a Python alternative.
190+
187191
### Development
188192

189193
Please see the [contribution guidelines](/CONTRIBUTING.md) to see installation instructions for contributing to Sequentia.

benchmarks/plot.ipynb

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,13 @@
88
"outputs": [],
99
"source": [
1010
"import matplotlib.pyplot as plt\n",
11-
"import numpy as np\n",
1211
"\n",
1312
"plt.style.use(\"ggplot\")"
1413
]
1514
},
1615
{
1716
"cell_type": "code",
1817
"execution_count": null,
19-
"id": "c92bf960-ddb5-409f-bd3c-5bce0a03ccd0",
20-
"metadata": {},
21-
"outputs": [],
22-
"source": [
23-
"from sequentia import"
24-
]
25-
},
26-
{
27-
"cell_type": "code",
28-
"execution_count": 79,
2918
"id": "6649bf2d-7430-401d-8113-f3c1e1cf4779",
3019
"metadata": {},
3120
"outputs": [
@@ -48,23 +37,36 @@
4837
"\n",
4938
"bars = ax.bar(labels, runtimes, width=0.5, color=\"C1\")\n",
5039
"ax.set(xlabel=\"Package\", ylabel=\"Runtime (s)\")\n",
51-
"ax.set_title(\"Univariate DTW-kNN performance (1,500 FSDD train/test sequences, 16 workers)\", fontsize=11)\n",
40+
"ax.set_title(\n",
41+
" (\n",
42+
" \"Univariate DTW-kNN performance \"\n",
43+
" \"(1,500 FSDD train/test sequences, 16 workers)\"\n",
44+
" ),\n",
45+
" fontsize=11,\n",
46+
")\n",
47+
"\n",
5248
"\n",
5349
"def fmt(s: float) -> str:\n",
50+
" \"\"\"Formats the runtime.\"\"\"\n",
5451
" if s < 60:\n",
5552
" return f\"{round(s)}s\"\n",
5653
" m, s = divmod(s, 60)\n",
5754
" return f\"{round(m)}m {round(s)}s\"\n",
5855
"\n",
56+
"\n",
5957
"for bar in bars:\n",
6058
" plt.text(\n",
61-
" bar.get_x() + bar.get_width() / 2, bar.get_height(),\n",
62-
" fmt(bar.get_height()), ha='center', va='bottom', fontsize=9,\n",
59+
" bar.get_x() + bar.get_width() / 2,\n",
60+
" bar.get_height(),\n",
61+
" fmt(bar.get_height()),\n",
62+
" ha=\"center\",\n",
63+
" va=\"bottom\",\n",
64+
" fontsize=9,\n",
6365
" )\n",
6466
"\n",
6567
"for lab in ax.get_xticklabels():\n",
66-
" if lab.get_text() == \"sequentia\":\n",
67-
" lab.set_fontweight('bold')\n",
68+
" if lab.get_text() == \"sequentia\":\n",
69+
" lab.set_fontweight(\"bold\")\n",
6870
"\n",
6971
"plt.tight_layout()\n",
7072
"plt.savefig(\"benchmark.svg\")\n",

benchmarks/test_pyts.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ def prepare(data: SequentialDataset, length: int) -> DataSplit:
3434
return X_pad[:, 0], data.y
3535

3636

37-
def multivariate(
38-
*, train_data: DataSplit, test_data: DataSplit, n_jobs: int
39-
) -> None:
37+
def run(*, train_data: DataSplit, test_data: DataSplit, n_jobs: int) -> None:
4038
"""Fit and predict the classifier."""
4139
# initialize model
4240
clf = KNeighborsClassifier(
@@ -70,7 +68,7 @@ def multivariate(
7068
)
7169

7270
benchmark = timeit.timeit(
73-
"func(train_data=train_data, test_data=test_data, n_jobs=args.n_jobs)",
71+
"run(train_data=train_data, test_data=test_data, n_jobs=args.n_jobs)",
7472
globals=locals(),
7573
number=args.number,
7674
)

benchmarks/test_sequentia.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
random_state: np.random.RandomState = np.random.RandomState(0)
2222

2323

24-
def multivariate(
24+
def run(
2525
*, train_data: SequentialDataset, test_data: SequentialDataset, n_jobs: int
2626
) -> None:
2727
"""Fit and predict the classifier."""
@@ -52,7 +52,7 @@ def multivariate(
5252
train_data, test_data = load_dataset(multivariate=False)
5353

5454
benchmark = timeit.timeit(
55-
"func(train_data=train_data, test_data=test_data, n_jobs=args.n_jobs)",
55+
"run(train_data=train_data, test_data=test_data, n_jobs=args.n_jobs)",
5656
globals=locals(),
5757
number=args.number,
5858
)

benchmarks/test_sktime.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ def prepare(data: SequentialDataset) -> DataSplit:
5656
return X_pd, data.y
5757

5858

59-
def multivariate(
60-
*, train_data: DataSplit, test_data: DataSplit, n_jobs: int
61-
) -> None:
59+
def run(*, train_data: DataSplit, test_data: DataSplit, n_jobs: int) -> None:
6260
"""Fit and predict the classifier."""
6361
# initialize model
6462
clf = KNeighborsTimeSeriesClassifier(
@@ -89,7 +87,7 @@ def multivariate(
8987
train_data, test_data = prepare(train_data), prepare(test_data)
9088

9189
benchmark = timeit.timeit(
92-
"func(train_data=train_data, test_data=test_data, n_jobs=args.n_jobs)",
90+
"run(train_data=train_data, test_data=test_data, n_jobs=args.n_jobs)",
9391
globals=locals(),
9492
number=args.number,
9593
)

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
project = "sequentia"
2424
copyright = "2019, Sequentia Developers" # noqa: A001
2525
author = "Edwin Onuonga (eonu)"
26-
release = "2.5.0"
26+
release = "2.6.0"
2727

2828
# -- General configuration ---------------------------------------------------
2929

make/lint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def check(c: Config) -> None:
3333
def format_(c: Config) -> None:
3434
"""Format Python files."""
3535
commands: list[str] = [
36-
"poetry run ruff --fix .",
36+
"poetry run ruff check --fix .",
3737
"poetry run ruff format .",
3838
]
3939
for command in commands:

pyproject.toml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "sequentia"
3-
version = "2.5.0"
3+
version = "2.6.0"
44
license = "MIT"
55
authors = ["Edwin Onuonga <ed@eonu.net>"]
66
maintainers = ["Edwin Onuonga <ed@eonu.net>"]
@@ -86,7 +86,7 @@ tox = "4.11.3"
8686
pre-commit = ">=3"
8787

8888
[tool.poetry.group.lint.dependencies]
89-
ruff = "0.1.3"
89+
ruff = "0.8.4"
9090
pydoclint = "0.3.8"
9191

9292
[tool.poetry.group.docs.dependencies]
@@ -100,8 +100,8 @@ pytest = { version = "^7.4.0" }
100100
pytest-cov = { version = "^4.1.0" }
101101

102102
[tool.ruff]
103-
required-version = "0.1.3"
104-
select = [
103+
required-version = "0.8.4"
104+
lint.select = [
105105
"F", # pyflakes: https://pypi.org/project/pyflakes/
106106
"E", # pycodestyle (error): https://pypi.org/project/pycodestyle/
107107
"W", # pycodestyle (warning): https://pypi.org/project/pycodestyle/
@@ -144,7 +144,7 @@ select = [
144144
"PERF", # perflint: https://pypi.org/project/perflint/
145145
"RUF", # ruff
146146
]
147-
ignore = [
147+
lint.ignore = [
148148
"ANN401", # https://beta.ruff.rs/docs/rules/any-type/
149149
"B905", # https://beta.ruff.rs/docs/rules/zip-without-explicit-strict/
150150
"TD003", # https://beta.ruff.rs/docs/rules/missing-todo-link/
@@ -162,16 +162,15 @@ ignore = [
162162
"C408", # Unnecessary `dict` call (rewrite as a literal)
163163
"D401", # First line of docstring should be in imperative mood
164164
]
165-
ignore-init-module-imports = true # allow unused imports in __init__.py
166165
line-length = 79
167166

168-
[tool.ruff.pydocstyle]
167+
[tool.ruff.lint.pydocstyle]
169168
convention = "numpy"
170169

171-
[tool.ruff.flake8-annotations]
170+
[tool.ruff.lint.flake8-annotations]
172171
allow-star-arg-any = true
173172

174-
[tool.ruff.extend-per-file-ignores]
173+
[tool.ruff.lint.extend-per-file-ignores]
175174
"__init__.py" = ["PLC0414", "F403", "F401", "F405"]
176175
"sequentia/datasets/*.py" = ["B006"]
177176
"sequentia/enums.py" = ["E501"]

0 commit comments

Comments
 (0)