milia.cluster.models.kshape#
k-Shape: shape-based clustering with cross-correlation distance (tslearn).
Classes
|
k-Shape (Paparrizos and Gravano, 2015); rows are z-normalised before clustering. |
|
Validated hyperparameters of the k-Shape clusterer. |
- class milia.cluster.models.kshape.KShape(n_clusters=3, n_init=1, max_iter=100, random_state=0)#
Bases:
BaseClustererk-Shape (Paparrizos and Gravano, 2015); rows are z-normalised before clustering.
- Parameters:
Examples
>>> import numpy as np >>> t = np.linspace(0, 2 * np.pi, 24) >>> X = np.vstack([np.sin(t + s) for s in (0.0, 0.1, 0.2)] + [np.cos(3 * t + s) for s in (0.0, 0.1, 0.2)]) >>> KShape(n_clusters=2).fit(X).labels_.tolist() [1, 1, 1, 0, 0, 0]
- class milia.cluster.models.kshape.KShapeConfig(*, name='kshape', kind='clusterer', space=SearchSpace(n_clusters=(2, 12)), n_clusters=3, n_init=1, max_iter=100, random_state=0)#
Bases:
BaseModelConfigValidated hyperparameters of the k-Shape clusterer.
Fields mirror
KShape’s constructor;spaceis the default Optuna search space. Build the clusterer withmake("clusterer", "kshape", ...)orKShape(**config.params()).Examples
>>> KShapeConfig().name 'kshape'