Skip to content

K-shape with specified initial condition runs the same initial condition until max attempts = 10 #524

Open
@r-millington

Description

@r-millington

Within clustering.kshape.fit() - lines 194-247 in tslearn/clustering/kshape version 0.6.3.

This issue occurs when an initial condition is specified in k-shape, rather than using random initialisation. If the initial condition supplied results in the EmptyClusterError being triggered ("Resumed because of empty cluster"), the model is fitted again with the same initial condition until max attempts = 10 with the same initial condition. As this initial condition is not random, the same result is achieved each time. This means the code is unnecessarily slow. Max_attempts cannot be controlled externally (line 207).

While I have code to reproduce the error, the dataset is too large to share here.

Instead of fitting the model until max_attempts = 10, max_attempts should be set to 1 when an initial condition is provided.

OS: ubuntu, tslearn version 0.5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions