tslearn-team / tslearn-team/tslearn
[Usage Question] Labels for "top k" best cluster assignments
Nobody has claimed this yet.
- 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:
-
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.
-
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.
-
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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