tslearn-team / tslearn-team/tslearn

TimeSeriesKmean: support sample_weight on fit

Open
#268 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi,

I opened an issue before but closed it later and decided to say it here in "Feature Request."

I was wondering if you could modify the TimeSeriesKmean function such that it can accept weight (as a callable function) in its metric_params for calculating the dtw_barycenteraveraging.

So:
metric_params = {'weights: ', my_function(data_points)}

So, it is a function that gets a set of data points (observations) and based on that calculates a weight vector and returns it. It gives the flexibility to the user to define a weight function and apply it throughout the clustering process.

(In my problem, for instance, I modified the centroid of the FINAL RESULT and see that it works better for me. However, if such modification can be applied throughout the whole clustering process (and just the final result), it might better enhance the final clusters and result.)

Best,
Nima

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 at TimeSeriesKmean.fit and the dtw_barycenter_averaging path to trace how metric_params are used during clustering. Clarify the callable weight interface and how its returned vector should flow through fitting. Done means callable sample weights are supported throughout clustering without changing existing behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.