You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Apparently, this part is added recently.
See: a091483
I think the param sample_weights should be added to the .fit method. (see KernelKmeans for reference)
inega
changed the title
TypeError when using TimeSeriesKMeans from kmeans_pluplus requiring sample_weight argument
TypeError when using TimeSeriesKMeans from kmeans_plusplus requiring sample_weight argument
Jul 4, 2023
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:
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.
The text was updated successfully, but these errors were encountered: