tslearn-team / tslearn-team/tslearn

TimeSeriesKMeans with custom metric

Open
#474 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

new feature
Dominant language
Python
Stars
3.2k
Forks
384
Avg merge
3d 12h
Merged PRs (30d)
11

Description

Hi,

I would like to do kDBA, but using a custom metric for computing the DTW alignments (not available in either scikit or scipy).

Now, dtw_variants has the dtw_path_from_metric function, so there it is always possible to compute dtw alignments for any pair of timeseries, passing the metric either as a functional, or by passing a pre-computed distance matrix (which for my purposes is not super-feasible).

Now, the problem is that the dba module only ever uses dtw_path, and so is always, at least implicitly, using euclidean distance. Is there a straigtforward way of passing custom metrics to TimeSeriesKMeans such that it computes the dtw alignments using a custom metric? It probably isn't too hard to change all calls to dtw_path to dtw_path_from_metric, conditional on a metric being provided. Just checking if there is an easier way.

Thanks,

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the dba module and the TimeSeriesKMeans path that currently calls dtw_path. Compare those calls with dtw_path_from_metric and its callable-metric interface in dtw_variants. Done means TimeSeriesKMeans can use a custom metric for DTW alignments without requiring a precomputed distance matrix.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.