Open
Description
I am currently having an issue with TimeSeriesKMeans (tslearn version 0.5.3.2, sklearn version 1.3.0, running on Windows, python 3.11). I initially tried to use the function on my own dataset, but managed to reproduce the error with the first example in the documentation page:
from tslearn.clustering import TimeSeriesKMeans
from tslearn.generators import random_walks
X = random_walks(n_ts=50, sz=32, d=1)
km = TimeSeriesKMeans(n_clusters=3, metric="euclidean", max_iter=5, random_state=0).fit(X)
Traceback (most recent call last):
Cell In[1], line 6
km = TimeSeriesKMeans(n_clusters=3, metric="euclidean", max_iter=5, random_state=0).fit(X)
File ~\.conda\envs\subsenv\Lib\site-packages\tslearn\clustering\kmeans.py:780 in fit
self._fit_one_init(X_, x_squared_norms, rs)
File ~\.conda\envs\subsenv\Lib\site-packages\tslearn\clustering\kmeans.py:629 in _fit_one_init
self.cluster_centers_ = _kmeans_plusplus(
TypeError: _kmeans_plusplus() missing 1 required positional argument: 'sample_weight'
I think this might be a version issue? The kmeans_pluplus docs indicate that the sample_weight argument was introduced in version 1.3 of scikit-learn, which was just released. I guess downgrading to a previous version will make it go away, but I thought of reporting it anyway, since other people will start getting the same error at some point.