tslearn-team / tslearn-team/tslearn

[Usage Question] Labels for "top k" best cluster assignments

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

Nobody has claimed this yet.

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

Description

Hello,

I am using kshape for time series data, and here are some general algorithm-agnostic clustering questions I have:

  1. I would like to obtain the top-m best assignments, not just the top-1 as found in labels_. So labels_ would be of size (N x m) instead of (N,), with m <= K.

  2. Inversely, I would like to obtain the top-m best samples for each cluster, i.e. the m samples most similar to a cluster's centroid. This would be a array of size (K x m), with m<=N.

  3. To somewhat resume from point #1 and #2, I would like to obtain distance matrix from all samples to all clusters (N x K). This matrix by itself should allow me to compute for the quantities desired in #1 and #2. I see there is a dist matrix used in the source code. Is there an easy way to access it through the API without hacking the source code?

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

The issue points to tslearn/clustering/kshape.py around line 155, where a distance matrix is used internally. Start by reviewing that computation and the KShape API, then clarify which of the top-m assignments, top-m samples, or full N×K distance matrix should be supported. Done would require an agreed public API and corresponding validation.

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
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.