Inconsistent calculation results between tslearn, pyts and fastdtw
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- numpy, python
- Ambito
- machine-learning
Direzione di ricerca
Inizia eseguendo l’esempio Python fornito e confrontando le chiamate a tslearn.metrics.dtw e pyts.metrics.dtw per i vincoli FastDTW e Sakoe-Chiba. Esamina quindi i punti di ingresso DTW rilevanti e la gestione dei vincoli; il lavoro è completato quando viene determinato il comportamento previsto e le discrepanze vengono risolte o documentate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
Please forgive me for my poor English since English is not my native language.
I have read the source code and Sakoe_Chiba band generation examples from tslearn, pyts. The generation manner of the Sakoe_Chiba seems different between pyts and tslearn, which leads to different calculation results when comparing 2 sequences with different lengths. I have also read the source code of fastdtw(https://pypi.org/project/fastdtw/) when the radius parameter is different, the calculation results between fastdtw and pyts are also varied.
Codes
import numpy as np
from tslearn.metrics import dtw as ts_dtw
from pyts.metrics import dtw as py_dtw
from fastdtw import fastdtw
if __name == "__main__":
np.random.seed(2020)
seq_0 = np.random.randn(140)
seq_1 = np.random.randn(50)
# Experiment 1: Different DTW caculation(Consistent)
# [INFO] DTW Calculation:
# -- tslearn dtw: 8.26240
# -- pyts dtw: 8.26240
print("[INFO] DTW Calculation:")
print("-- tslearn dtw: {:.5f}".format(ts_dtw(seq_0, seq_1)))
print("-- pyts dtw: {:.5f}".format(py_dtw(seq_0, seq_1)))
py_dtw
# Experiment 2: FastDTW calculation(Inconsistent)
# [INFO] FastDTW Calculation:
# -- FastDTW results: 8.67608
# -- pyts FastDTW: 9.12243
print("\n[INFO] FastDTW Calculation:")
print("-- FastDTW results: {:.5f}".format(
np.sqrt(fastdtw(seq_0, seq_1, radius=2, dist=lambda x, y: (x-y)**2)[0])))
print("-- pyts FastDTW: {:.5f}".format(
py_dtw(seq_0, seq_1, method="fast", options={"radius": 2})))
# Experiment 3: Sakoe_Chiba calculation(Inconsistent)
# [INFO] Sakoe_Chiba Calculation:
# -- tslearn Sakoe_Chiba dtw: 8.26240
# -- pyts Sakoe_Chiba dtw: 10.49161
print("\n[INFO] Sakoe_Chiba Calculation:")
print("-- tslearn Sakoe_Chiba dtw: {:.5f}".format(
ts_dtw(seq_0, seq_1, sakoe_chiba_radius=5)))
print("-- pyts Sakoe_Chiba dtw: {:.5f}".format(
py_dtw(seq_0, seq_1, method="sakoechiba", options={"window_size": 5})))
# Experiment 4: itakura calculation(In this example, they are consistent, however, I haven't read the source code yet)
# [INFO] itakura Calculation:
# -- tslearn itakura dtw: 8.51087
# -- pyts itakura dtw: 8.51087
print("\n[INFO] itakura Calculation:")
print("-- tslearn itakura dtw: {:.5f}".format(
ts_dtw(seq_0, seq_1, itakura_max_slope=6)))
print("-- pyts itakura dtw: {:.5f}".format(
py_dtw(seq_0, seq_1, method="itakura", options={"max_slope": 6})))
Versions
OS: Ubuntu 18.04.4 LTS
NumPy 1.18.1
SciPy 1.4.1
Scikit-Learn 0.22.1
Numba 0.49.1
Pyts 0.11.0
tslearn: '0.4.1'
fastdtw: See pypi
- Lingua principale
- Python
- Stelle
- 3.2k
- Fork
- 397
- Merge medio
- 1g 19h
- PR unite (30g)
- 17
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tslearn-team/tslearn
-
1d-SAX distance shifts the representative segment center by half a sampleForse già presa @ktz03 l’ha presa 4 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tslearn-team/tslearn#776 ·
I maintainer di solito rispondono entro 2 giorni
-
from_sktime_dataset fails or reorders rows for non-default integer indexesForse già presa @ktz03 l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tslearn-team/tslearn#773 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
SAX classifier predictions depend on query batch composition with scale=TrueForse già presa @antonsoo l’ha presa 7 giorni fa. Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 20/100
tslearn-team/tslearn#775 ·
I maintainer di solito rispondono entro 2 giorni
-
dtw_barycenter_averaging_subgradient ignores weights, and a zero weight gives NaNForse già presa @raashish1601 l’ha presa 10 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 20/100
tslearn-team/tslearn#764 ·
I maintainer di solito rispondono entro 2 giorni
-
MatrixProfile (numpy implementation) returns all NaN for a NaN-padded / variable length time seriesForse già presa @SajalDevX l’ha presa 12 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
tslearn-team/tslearn#753 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di tslearn-team/tslearn
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
aws-samples/sample-per-model-bedrock#295 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
pyrevitlabs/pyRevit#3792 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
zephyrproject-rtos/reqmgmt#177 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
polarsource/polar#15580 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
521xueweihan/HelloGitHub#4011 ·