Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lixun910/time-series
https://github.com/lixun910/time-series
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/lixun910/time-series
- Owner: lixun910
- Created: 2014-05-20T17:39:03.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-05-13T22:37:54.000Z (over 9 years ago)
- Last Synced: 2023-08-07T09:12:29.880Z (over 1 year ago)
- Language: Python
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
time-series
===========DBA: Dynamic Time Wrapping Barycenter Averaging (DBA).
Dynamic Time Wrapper in Python
This is an implementation of the algorithm presented in:
A global averaging method for dynamic time warping, with applications to clustering, Petitjean et. al.
(http://dpt-info.u-strasbg.fr/~fpetitjean/Research/Petitjean2011-PR.pdf)This AS-IS python script is a translation of Petitjean's Java code of DBA algorithm.
Usage
=====
Suppose you have N time-series data, each with length M._sequences_: a NxM numpy array, each row is a original time-series data
_averageSequence_: a Nx1 numpy array, for the first time DBA call, this could be a reasonable guess of averageSequence.
```
DBA(averageSequence, sequences)
```Example
=======
```python
# create fake 100x20 time-series data
sequences = np.zeros((100,20))
for i in range(100):
for j in range(20):
sequences[i][j] = math.cos(random.random()*j/20.0*math.pi)
# generate first guess of averageSeuqnce
averageSequence = np.zeros(20)
choice = (int) (random.random() * 100)
for i in range(20):
averageSequence[i] = sequences[choice][i]
# run DBA several times to get a converged averageSequence
print "[%s]" % " ".join([str(i)for i in averageSequence])
DBA(averageSequence, sequences)
print "[%s]" % " ".join([str(i)for i in averageSequence])
DBA(averageSequence, sequences)
print "[%s]" % " ".join([str(i)for i in averageSequence])
```