tslearn-team / tslearn-team/tslearn

Soft DTW with ignore_padding_token

Open
#515 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hello,

I have a batch of pairs of sequences. Each pair contains sequences of different lengths, which are padded to equal lengths. Is there a way to ignore these padded elements to compute the soft-dtw alignment? For example, https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html provides a feature to ignore a particular class index to compute cross-entropy loss.

Do you suggest any workaround to compute the dtw loss efficiently in such a case? I can only think of processing (removing paddings) each pair sample individually, but this will be too slow.

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 reviewing tslearn's soft-DTW alignment behavior and the PyTorch CrossEntropyLoss ignore-index reference mentioned in the issue. Determine how padded elements should be identified and excluded in batched sequences; done means soft-DTW can handle differently sized padded pairs efficiently without processing each sample individually.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.