tscglue 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. tscglue-0.1.1/.github/workflows/publish.yml +67 -0
  2. tscglue-0.1.1/.github/workflows/tests.yml +24 -0
  3. tscglue-0.1.1/.gitignore +36 -0
  4. tscglue-0.1.1/Makefile +38 -0
  5. tscglue-0.1.1/PKG-INFO +74 -0
  6. tscglue-0.1.1/README.md +33 -0
  7. tscglue-0.1.1/experimental/README.md +152 -0
  8. tscglue-0.1.1/experimental/run_stacking2.py +500 -0
  9. tscglue-0.1.1/experimental/run_stacking2.slurm +25 -0
  10. tscglue-0.1.1/experimental/run_worms.py +84 -0
  11. tscglue-0.1.1/notebooks/043-transformations.ipynb +1532 -0
  12. tscglue-0.1.1/notebooks/052-speedup.ipynb +2233 -0
  13. tscglue-0.1.1/notebooks/053-rstsf.ipynb +709 -0
  14. tscglue-0.1.1/notebooks/054-dr-cif.ipynb +416 -0
  15. tscglue-0.1.1/notebooks/057-rocket-subsempling-features.ipynb +242 -0
  16. tscglue-0.1.1/notebooks/060-rocket-types.ipynb +685 -0
  17. tscglue-0.1.1/notebooks/061-chronos2-embeddings.ipynb +453 -0
  18. tscglue-0.1.1/notebooks/062-timing-benchmark.ipynb +2989 -0
  19. tscglue-0.1.1/notebooks/063-multivariate.ipynb +252 -0
  20. tscglue-0.1.1/notebooks/064-missing-data.ipynb +3311 -0
  21. tscglue-0.1.1/notebooks/065-multifold.ipynb +712 -0
  22. tscglue-0.1.1/notebooks/066-auto-fold-size.ipynb +434 -0
  23. tscglue-0.1.1/notebooks/067-tsfm-mantis.ipynb +613 -0
  24. tscglue-0.1.1/notebooks/068-transformers.ipynb +334 -0
  25. tscglue-0.1.1/notebooks/069-tabicl.ipynb +1344 -0
  26. tscglue-0.1.1/notebooks/070-quant-features.ipynb +161 -0
  27. tscglue-0.1.1/notebooks/071-multirocket-tabicl.ipynb +194 -0
  28. tscglue-0.1.1/notebooks/072-tsfresh-features.ipynb +229 -0
  29. tscglue-0.1.1/notebooks/TASKS.md +15 -0
  30. tscglue-0.1.1/notebooks/bakeoff.ipynb +1075 -0
  31. tscglue-0.1.1/notebooks/debug_chronos_hydra.ipynb +236 -0
  32. tscglue-0.1.1/notebooks/debug_missing.ipynb +363 -0
  33. tscglue-0.1.1/notebooks/monash-download.ipynb +582 -0
  34. tscglue-0.1.1/notebooks/mrHydra-scaler-testing.ipynb +441 -0
  35. tscglue-0.1.1/notebooks/rstsf_comparison.ipynb +292 -0
  36. tscglue-0.1.1/notebooks/usplit.ipynb +178 -0
  37. tscglue-0.1.1/pyproject.toml +80 -0
  38. tscglue-0.1.1/tests/__init__.py +1 -0
  39. tscglue-0.1.1/tests/test_model.py +87 -0
  40. tscglue-0.1.1/tscglue/__init__.py +0 -0
  41. tscglue-0.1.1/tscglue/data_loader.py +82 -0
  42. tscglue-0.1.1/tscglue/gpu_models.py +454 -0
  43. tscglue-0.1.1/tscglue/interval_models.py +723 -0
  44. tscglue-0.1.1/tscglue/models.py +2863 -0
  45. tscglue-0.1.1/tscglue/models_tsfm.py +418 -0
  46. tscglue-0.1.1/tscglue/transformers.py +292 -0
  47. tscglue-0.1.1/tscglue/utils.py +117 -0
@@ -0,0 +1,67 @@
1
+ name: Build, Tag and Publish
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ build-tag-publish:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ id-token: write
14
+
15
+ steps:
16
+ - name: Checkout code
17
+ uses: actions/checkout@v4
18
+ with:
19
+ fetch-depth: 0
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v5
23
+ with:
24
+ enable-cache: true
25
+
26
+ - name: Get version from pyproject.toml
27
+ id: pyproject
28
+ run: |
29
+ VERSION=$(python3 -c "import pathlib, re; \
30
+ content = pathlib.Path('pyproject.toml').read_text(); \
31
+ match = re.search(r'^version\s*=\s*[\" \']([^\" \']+)[\" \']', content, re.MULTILINE); \
32
+ print(match.group(1)) if match else exit(1)")
33
+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
34
+
35
+ - name: Check if Tag exists
36
+ id: tag_check
37
+ run: |
38
+ if git rev-parse "v${{ steps.pyproject.outputs.VERSION }}" >/dev/null 2>&1; then
39
+ echo "EXISTS=true" >> $GITHUB_OUTPUT
40
+ else
41
+ echo "EXISTS=false" >> $GITHUB_OUTPUT
42
+ fi
43
+
44
+ - name: Build package
45
+ run: uv run --with build python -m build
46
+
47
+ - name: Update GitHub Release
48
+ uses: softprops/action-gh-release@v2
49
+ with:
50
+ tag_name: v${{ steps.pyproject.outputs.VERSION }}
51
+ name: Release v${{ steps.pyproject.outputs.VERSION }}
52
+ files: dist/*
53
+ # This forces GitHub to move the tag and overwrite the files
54
+ overwrite: true
55
+ # Ensures the tag is updated to the current commit if it already exists
56
+ force_tag_update: true
57
+ env:
58
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59
+
60
+ - name: Publish to PyPI
61
+ # CRITICAL: We skip this if the version already exists on PyPI
62
+ # because TestPyPI will reject the upload and fail the workflow.
63
+ if: steps.tag_check.outputs.EXISTS == 'false'
64
+ uses: pypa/gh-action-pypi-publish@release/v1
65
+ with:
66
+ # repository-url: https://test.pypi.org/legacy/
67
+ print-hash: true
@@ -0,0 +1,24 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, develop ]
6
+ pull_request:
7
+ branches: [ main, develop ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - name: Checkout code
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Install uv
18
+ run: |
19
+ curl -LsSf https://astral.sh/uv/install.sh | sh
20
+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
21
+
22
+ - name: Run tests
23
+ run: |
24
+ make tests
@@ -0,0 +1,36 @@
1
+ # Experiment files
2
+ experiments/
3
+
4
+ # Python cache
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+
9
+ # Virtual environments
10
+ .venv/
11
+ venv/
12
+ env/
13
+ ENV/
14
+
15
+ # IDE
16
+ .vscode/
17
+ .idea/
18
+ *.swp
19
+ *.swo
20
+ *~
21
+
22
+ # Jupyter Notebook checkpoints
23
+ .ipynb_checkpoints/
24
+
25
+ # Distribution / packaging
26
+ dist/
27
+ build/
28
+ *.egg-info/
29
+
30
+ # uv lock file (library - not needed in git)
31
+ uv.lock
32
+
33
+ # Data
34
+ data/
35
+ figures/
36
+ results/
tscglue-0.1.1/Makefile ADDED
@@ -0,0 +1,38 @@
1
+ .PHONY: help install-uv setup list clean tests format download-ucr download-models
2
+ .ONESHELL:
3
+
4
+ help: ## Show available commands
5
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
6
+
7
+ install-uv: ## Install uv package manager
8
+ curl -LsSf https://astral.sh/uv/install.sh | sh
9
+
10
+ setup: ## Sets up everything needed for a new deployment
11
+ uv sync --all-extras
12
+
13
+ list:
14
+ @LC_ALL=C $(MAKE) -pRrq -f $(firstword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/(^|\n)# Files(\n|$$)/,/(^|\n)# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | grep -E -v -e '^[^[:alnum:]]' -e '^$@$$'
15
+
16
+ clean: ## Removes env, docs and caches
17
+ rm -rf build/docs
18
+ rm -rf ~/.exturion
19
+ rm -rf .venv
20
+ uv clean all
21
+ uv cache clean
22
+
23
+ tests: ## Run the unit tests
24
+ uv run --extra dev pytest tests/ -vv -W ignore::DeprecationWarning --capture=no --durations=0 --cache-clear --maxfail=1
25
+
26
+ format: ## Format the code with isort and ruff
27
+ uv run --extra dev isort . --profile black
28
+ uv run --extra dev ruff format .
29
+ uv run --extra dev ruff check . --fix
30
+
31
+ download-models: ## Pre-download HF models (Mantis, Chronos-2) for offline/SLURM use
32
+ uv run --no-sync python -c "from tscglue.models_tsfm import download_models; download_models()"
33
+
34
+ download-ucr: ## Download and unzip UCR archive (all folds) into data/
35
+ mkdir -p data
36
+ curl -L -o data/ucr.zip 'https://drive.usercontent.google.com/download?id=1V36LSZLAK6FIYRfPx6mmE5euzogcXS83&export=download&authuser=0&confirm=t&uuid=07e23200-74c3-4fd6-ba24-c5cde6e39a45&at=APcXIO39z41iEW4mVw4ltHUn9yYC%3A1769851071815'
37
+ unzip -o data/ucr.zip -d data/
38
+ rm data/ucr.zip
tscglue-0.1.1/PKG-INFO ADDED
@@ -0,0 +1,74 @@
1
+ Metadata-Version: 2.4
2
+ Name: tscglue
3
+ Version: 0.1.1
4
+ Summary: Automatic Time Series Classification
5
+ Requires-Python: <3.14,>=3.12
6
+ Requires-Dist: aeon>=1.3.0
7
+ Requires-Dist: click
8
+ Requires-Dist: huggingface-hub
9
+ Requires-Dist: imblearn
10
+ Requires-Dist: polars
11
+ Requires-Dist: pyarrow
12
+ Requires-Dist: pytorch-lightning
13
+ Requires-Dist: scikit-learn
14
+ Requires-Dist: seaborn
15
+ Requires-Dist: statsmodels
16
+ Requires-Dist: tabicl
17
+ Requires-Dist: torch
18
+ Requires-Dist: tqdm
19
+ Requires-Dist: tsfresh
20
+ Provides-Extra: dev
21
+ Requires-Dist: awscli; extra == 'dev'
22
+ Requires-Dist: boto3; extra == 'dev'
23
+ Requires-Dist: isort; extra == 'dev'
24
+ Requires-Dist: moto[s3]; extra == 'dev'
25
+ Requires-Dist: pytest; extra == 'dev'
26
+ Requires-Dist: ruff; extra == 'dev'
27
+ Requires-Dist: s3fs; extra == 'dev'
28
+ Provides-Extra: notebooks
29
+ Requires-Dist: accelerate; extra == 'notebooks'
30
+ Requires-Dist: catboost; extra == 'notebooks'
31
+ Requires-Dist: chronos-forecasting; extra == 'notebooks'
32
+ Requires-Dist: hvplot; extra == 'notebooks'
33
+ Requires-Dist: ipykernel; extra == 'notebooks'
34
+ Requires-Dist: jupyter; extra == 'notebooks'
35
+ Requires-Dist: jupyterlab; extra == 'notebooks'
36
+ Requires-Dist: lightgbm; extra == 'notebooks'
37
+ Requires-Dist: mantis-tsfm; extra == 'notebooks'
38
+ Requires-Dist: pandas; extra == 'notebooks'
39
+ Requires-Dist: transformers; extra == 'notebooks'
40
+ Description-Content-Type: text/markdown
41
+
42
+ # TSCGlue
43
+
44
+ Automatic Time Series Classification library built on top of aeon and scikit-learn.
45
+
46
+ ## Installation
47
+
48
+ ```bash
49
+ pip install tscglue
50
+ ```
51
+
52
+ ## Quick Start
53
+
54
+ ```python
55
+ from tscglue import utils
56
+ from tscglue.models import TSCGlue
57
+ from sklearn.metrics import accuracy_score
58
+
59
+ # Load a time series classification dataset
60
+ X_train, y_train, X_test, y_test = utils.load_dataset("ArrowHead")
61
+
62
+ # Create and train the model
63
+ model = TSCGlue(
64
+ random_state=270,
65
+ k_folds=10,
66
+ n_jobs=-1
67
+ )
68
+ model.fit(X_train, y_train)
69
+
70
+ # Make predictions
71
+ y_pred = model.predict(X_test)
72
+ accuracy = accuracy_score(y_test, y_pred)
73
+ print(f"Accuracy: {accuracy:.4f}")
74
+ ```
@@ -0,0 +1,33 @@
1
+ # TSCGlue
2
+
3
+ Automatic Time Series Classification library built on top of aeon and scikit-learn.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install tscglue
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ from tscglue import utils
15
+ from tscglue.models import TSCGlue
16
+ from sklearn.metrics import accuracy_score
17
+
18
+ # Load a time series classification dataset
19
+ X_train, y_train, X_test, y_test = utils.load_dataset("ArrowHead")
20
+
21
+ # Create and train the model
22
+ model = TSCGlue(
23
+ random_state=270,
24
+ k_folds=10,
25
+ n_jobs=-1
26
+ )
27
+ model.fit(X_train, y_train)
28
+
29
+ # Make predictions
30
+ y_pred = model.predict(X_test)
31
+ accuracy = accuracy_score(y_test, y_pred)
32
+ print(f"Accuracy: {accuracy:.4f}")
33
+ ```
@@ -0,0 +1,152 @@
1
+ # AutoTSC
2
+
3
+ - Does selection models based on val performance even work?
4
+ - Which ensemble method should AutoML use as a function of dataset size? (stacking double stacking weights like now?)
5
+ - Does the validation-test disconnect generalize across domains, or is it TSC-specific?
6
+ - Does nested CV actually solve the small-sample problem?
7
+ - Does downsampling work?
8
+ - Does multifidelity work?
9
+ - No AutoML due to small datasets?
10
+ - How often is best val model best on train (shuffled/no shuffled)
11
+ - Resampling should be done or not?
12
+
13
+
14
+ ✅ 1. First-order & local-transform views
15
+
16
+ These change the shape or local structure of the series.
17
+
18
+ ✔ Differencing (Δx)
19
+
20
+ Good for removing trends, enhancing sharp transitions.
21
+
22
+ ✔ Cumulative sum
23
+
24
+ Smooths noise; emphasises long-term structure.
25
+
26
+ ✔ Moving average / smoothing (SG filter, EMA)
27
+
28
+ Suppresses high-frequency noise → different model inductive bias.
29
+
30
+ ✔ Trend removal (detrending)
31
+
32
+ Removes global shape and highlights wiggles.
33
+
34
+ ✅ 2. Frequency & phase transforms
35
+
36
+ Often extremely useful because they create orthogonal representations.
37
+
38
+ ✔ FFT magnitude
39
+
40
+ Spectral view of the series — deep models love it.
41
+
42
+ ✔ FFT phase
43
+
44
+ Adds complementary structure to magnitude.
45
+
46
+ ✔ STFT / Sliding FFT
47
+
48
+ Time-frequency representation (use 1D vector summary or window-level stats).
49
+
50
+ ✔ Wavelet transform (CWT, DWT)
51
+
52
+ Great for multi-resolution patterns.
53
+
54
+ ✔ Hilbert transform
55
+
56
+ Creates an analytic signal: amplitude envelope + instantaneous phase.
57
+
58
+ ✅ 3. Shape & geometric transforms
59
+
60
+ Excellent for diversity because they are structurally different.
61
+
62
+ ✔ Time warping (random or deterministic)
63
+
64
+ Warps the timeline → great for shape-based algorithms.
65
+
66
+ ✔ Curve length transform
67
+
68
+ Turns a series into cumulative path length.
69
+
70
+ ✔ Polar coordinate transform
71
+
72
+ Convert (x, diff(x)) into polar angle + magnitude.
73
+
74
+ ✔ Slope transform
75
+
76
+ Use local slope or angle instead of raw values.
77
+
78
+ ✅ 4. Normalization-based transforms
79
+
80
+ Don’t underestimate these — especially helpful with ROCKET/Hydra ensembles.
81
+
82
+ ✔ Z-normalization (per series)
83
+
84
+ Baseline for most TSC but provides a different view from raw scale.
85
+
86
+ ✔ Min–max scaling
87
+
88
+ Good for emphasising relative shape.
89
+
90
+ ✔ Unit energy / L2 normalization
91
+
92
+ Highlights relative oscillations.
93
+
94
+ ✔ Robust scaling (median/IQR)
95
+
96
+ When outliers distort structure.
97
+
98
+ ✅ 5. Feature extraction transforms
99
+
100
+ These produce feature vectors that a classifier sees differently from the raw TS.
101
+
102
+ ✔ Catch22
103
+
104
+ 22 interpretable features — often complementary to ROCKET.
105
+
106
+ ✔ TSFresh / TSFEL feature subsets
107
+
108
+ Huge diversity if you select subsets.
109
+
110
+ ✔ Autocorrelation / partial autocorrelation vectors
111
+
112
+ Very different inductive bias.
113
+
114
+ ✔ Shapelet distances
115
+
116
+ Distance to “prototype” shapes.
117
+
118
+ ✅ 6. Windowing & multi-resolution views
119
+
120
+ Often extremely strong for ensembling.
121
+
122
+ ✔ Multi-scale segment averaging
123
+
124
+ Compute downsampled versions at multiple resolutions.
125
+
126
+ ✔ Piecewise transforms
127
+
128
+ PAA (Piecewise aggregate approximation)
129
+
130
+ PLA (Piecewise linear approximation)
131
+
132
+ SAX (Symbolic Aggregate Approximation)
133
+
134
+ ✔ Moving-window statistics
135
+
136
+ Rolling min/max/std/skew/kurt.
137
+
138
+ ✅ 7. Noise & augmentation transforms (for diversity)
139
+
140
+ Used often in Hydra/ROCKET ensembles to create diverse models.
141
+
142
+ ✔ Add small Gaussian noise
143
+
144
+ Mild regularization; different learned filters.
145
+
146
+ ✔ Jittering / scaling
147
+
148
+ Preserves topology but shifts amplitude.
149
+
150
+ ✔ Dropout segments
151
+
152
+ Removes random subsequences → encourages robustness.