tsdr 0.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.
- tsdr-0.1/LICENSE.txt +21 -0
- tsdr-0.1/PKG-INFO +94 -0
- tsdr-0.1/README.md +77 -0
- tsdr-0.1/pyproject.toml +34 -0
- tsdr-0.1/tsdr/.DS_Store +0 -0
- tsdr-0.1/tsdr/__init__.py +1 -0
- tsdr-0.1/tsdr/autocorrelation.py +745 -0
- tsdr-0.1/tsdr/determinism.py +304 -0
- tsdr-0.1/tsdr/diffusion.py +401 -0
- tsdr-0.1/tsdr/latentvariable.py +275 -0
- tsdr-0.1/tsdr/nonstationarity.py +1150 -0
- tsdr-0.1/tsdr/predictability.py +492 -0
- tsdr-0.1/tsdr/slowness.py +256 -0
tsdr-0.1/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Kieran Samuel Owens
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
tsdr-0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: tsdr
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Time-series dimension reduction
|
|
5
|
+
Author-Email: Kieran S Owens <kowe6911@uni.sydney.edu.au>
|
|
6
|
+
Maintainer-Email: Kieran S Owens <kowe6911@uni.sydney.edu.au>
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Project-URL: GitHub Repository (tsdr), https://github.com/KieranOwens/tsdr
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Requires-Dist: scipy
|
|
13
|
+
Requires-Dist: scikit-learn
|
|
14
|
+
Requires-Dist: pywavelets
|
|
15
|
+
Requires-Dist: kneed
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
<h1 align="center"><em>tsdr</em>: Time-Series Dimension Reduction</h1>
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" height="20"/></a>
|
|
22
|
+
<a href="https://twitter.com/compTimeSeries"><img src="https://img.shields.io/twitter/url/https/twitter.com/compTimeSeries.svg?style=social&label=Follow%20%40compTimeSeries" height="20"/></a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
<p align="center"><img src="img/tsdr_categories.png" height="300"/></p>
|
|
27
|
+
|
|
28
|
+
## About
|
|
29
|
+
|
|
30
|
+
Time-series dimension reduction (TSDR) methods are a class of algorithms for the dimension reduction of multivariate data that exploit temporal structure. As compared to general dimension reduction (GDR) methods, the outputs of which are invariant to temporal permutation, TSDR methods are sensitive to temporal structure.
|
|
31
|
+
|
|
32
|
+
The figure above visually summarises the categories of TSDR methods that we defined in Owens & Fulcher (2025). The first five categories (a-e) consist of methods that extract time-series components based on different aspects of temporal structure, i.e., slowness, autocorrelation, predictability, determinism, and non-stationarity. The final two categories (f-g) consist of methods that share a common methodology, i.e., diffusion-based and latente variable methods.
|
|
33
|
+
|
|
34
|
+
The <em>tsdr</em> package provides python implementations of TSDR methods from each of these seven categories. The methods are written in a simple, readable style to enable time-series analysts to better understand a subset of the TSDR methods discussed in the Owens & Fulcher (2025) review paper.
|
|
35
|
+
|
|
36
|
+
### Acknowledgement :
|
|
37
|
+
|
|
38
|
+
If you use this software, please read and cite this open-access article:
|
|
39
|
+
|
|
40
|
+
- 📗 Owens & Fulcher [Time-series dimension reduction: a comprehensive review and conceptual unification of algorithms](url), _arXiv_ (In Preparation).
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
Using `pip` for [`tsdr`](https://pypi.org/project/tsdr/):
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
pip install tsdr
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from tsdr.slowness import SFA
|
|
55
|
+
|
|
56
|
+
import numpy as np
|
|
57
|
+
import scipy
|
|
58
|
+
import matplotlib.pyplot as plt
|
|
59
|
+
|
|
60
|
+
# create a dataset for analysis
|
|
61
|
+
# a sinusoid
|
|
62
|
+
z = np.sin(np.linspace(0, 4*np.pi, 1000))
|
|
63
|
+
# multichannel noise
|
|
64
|
+
D = 10
|
|
65
|
+
noise = np.random.normal(scale=1.0, size=((len(z), D-1)))
|
|
66
|
+
# linear mixing
|
|
67
|
+
A = scipy.stats.ortho_group.rvs(D, random_state=1)
|
|
68
|
+
X = np.concatenate([z.reshape(-1,1), noise], axis=1) @ A
|
|
69
|
+
|
|
70
|
+
# extract a slow component using SFA
|
|
71
|
+
slow_component = SFA(n_components=1).fit_transform(X)
|
|
72
|
+
|
|
73
|
+
# visualise the component
|
|
74
|
+
fig, axs = plt.subplots(6, 1, figsize=(8, 8))
|
|
75
|
+
axs[0].plot(slow_component, lw=1.0)
|
|
76
|
+
axs[0].set_ylabel('SFA1')
|
|
77
|
+
for i in range(D):
|
|
78
|
+
axs[i].spines[['right', 'top', 'bottom']].set_visible(False)
|
|
79
|
+
axs[i].set_xticks([])
|
|
80
|
+
axs[i+1].plot(X[:, i], c='black', linewidth=0.5)
|
|
81
|
+
axs[i+1].set_ylabel(f'X{i+1}')
|
|
82
|
+
axs[D].spines[['right', 'top']].set_visible(False)
|
|
83
|
+
axs[D].set_xlabel('Time')
|
|
84
|
+
plt.tight_layout()
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
<p align="center"><img src="img/sfa_example.png" height="600"/></p>
|
|
89
|
+
|
|
90
|
+
<!-- ## Usage notes
|
|
91
|
+
-
|
|
92
|
+
-
|
|
93
|
+
-->
|
|
94
|
+
|
tsdr-0.1/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<h1 align="center"><em>tsdr</em>: Time-Series Dimension Reduction</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" height="20"/></a>
|
|
5
|
+
<a href="https://twitter.com/compTimeSeries"><img src="https://img.shields.io/twitter/url/https/twitter.com/compTimeSeries.svg?style=social&label=Follow%20%40compTimeSeries" height="20"/></a>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<p align="center"><img src="img/tsdr_categories.png" height="300"/></p>
|
|
10
|
+
|
|
11
|
+
## About
|
|
12
|
+
|
|
13
|
+
Time-series dimension reduction (TSDR) methods are a class of algorithms for the dimension reduction of multivariate data that exploit temporal structure. As compared to general dimension reduction (GDR) methods, the outputs of which are invariant to temporal permutation, TSDR methods are sensitive to temporal structure.
|
|
14
|
+
|
|
15
|
+
The figure above visually summarises the categories of TSDR methods that we defined in Owens & Fulcher (2025). The first five categories (a-e) consist of methods that extract time-series components based on different aspects of temporal structure, i.e., slowness, autocorrelation, predictability, determinism, and non-stationarity. The final two categories (f-g) consist of methods that share a common methodology, i.e., diffusion-based and latente variable methods.
|
|
16
|
+
|
|
17
|
+
The <em>tsdr</em> package provides python implementations of TSDR methods from each of these seven categories. The methods are written in a simple, readable style to enable time-series analysts to better understand a subset of the TSDR methods discussed in the Owens & Fulcher (2025) review paper.
|
|
18
|
+
|
|
19
|
+
### Acknowledgement :
|
|
20
|
+
|
|
21
|
+
If you use this software, please read and cite this open-access article:
|
|
22
|
+
|
|
23
|
+
- 📗 Owens & Fulcher [Time-series dimension reduction: a comprehensive review and conceptual unification of algorithms](url), _arXiv_ (In Preparation).
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Using `pip` for [`tsdr`](https://pypi.org/project/tsdr/):
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
pip install tsdr
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from tsdr.slowness import SFA
|
|
38
|
+
|
|
39
|
+
import numpy as np
|
|
40
|
+
import scipy
|
|
41
|
+
import matplotlib.pyplot as plt
|
|
42
|
+
|
|
43
|
+
# create a dataset for analysis
|
|
44
|
+
# a sinusoid
|
|
45
|
+
z = np.sin(np.linspace(0, 4*np.pi, 1000))
|
|
46
|
+
# multichannel noise
|
|
47
|
+
D = 10
|
|
48
|
+
noise = np.random.normal(scale=1.0, size=((len(z), D-1)))
|
|
49
|
+
# linear mixing
|
|
50
|
+
A = scipy.stats.ortho_group.rvs(D, random_state=1)
|
|
51
|
+
X = np.concatenate([z.reshape(-1,1), noise], axis=1) @ A
|
|
52
|
+
|
|
53
|
+
# extract a slow component using SFA
|
|
54
|
+
slow_component = SFA(n_components=1).fit_transform(X)
|
|
55
|
+
|
|
56
|
+
# visualise the component
|
|
57
|
+
fig, axs = plt.subplots(6, 1, figsize=(8, 8))
|
|
58
|
+
axs[0].plot(slow_component, lw=1.0)
|
|
59
|
+
axs[0].set_ylabel('SFA1')
|
|
60
|
+
for i in range(D):
|
|
61
|
+
axs[i].spines[['right', 'top', 'bottom']].set_visible(False)
|
|
62
|
+
axs[i].set_xticks([])
|
|
63
|
+
axs[i+1].plot(X[:, i], c='black', linewidth=0.5)
|
|
64
|
+
axs[i+1].set_ylabel(f'X{i+1}')
|
|
65
|
+
axs[D].spines[['right', 'top']].set_visible(False)
|
|
66
|
+
axs[D].set_xlabel('Time')
|
|
67
|
+
plt.tight_layout()
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
<p align="center"><img src="img/sfa_example.png" height="600"/></p>
|
|
72
|
+
|
|
73
|
+
<!-- ## Usage notes
|
|
74
|
+
-
|
|
75
|
+
-
|
|
76
|
+
-->
|
|
77
|
+
|
tsdr-0.1/pyproject.toml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tsdr"
|
|
3
|
+
version = "0.1"
|
|
4
|
+
authors = [
|
|
5
|
+
{ name = "Kieran S Owens", email = "kowe6911@uni.sydney.edu.au" },
|
|
6
|
+
]
|
|
7
|
+
maintainers = [
|
|
8
|
+
{ name = "Kieran S Owens", email = "kowe6911@uni.sydney.edu.au" },
|
|
9
|
+
]
|
|
10
|
+
description = "Time-series dimension reduction"
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
requires-python = ">=3.8"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
]
|
|
17
|
+
dependencies = [
|
|
18
|
+
"numpy",
|
|
19
|
+
"scipy",
|
|
20
|
+
"scikit-learn",
|
|
21
|
+
"pywavelets",
|
|
22
|
+
"kneed",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
"GitHub Repository (tsdr)" = "https://github.com/KieranOwens/tsdr"
|
|
27
|
+
|
|
28
|
+
[build-system]
|
|
29
|
+
requires = [
|
|
30
|
+
"pdm-backend",
|
|
31
|
+
]
|
|
32
|
+
build-backend = "pdm.backend"
|
|
33
|
+
|
|
34
|
+
[tool]
|
tsdr-0.1/tsdr/.DS_Store
ADDED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
### empty file ###
|