Skip to content

MiniBatchKMeans partial_fit uninformative error message when number of features changes #12430

Closed
@jeremiedbb

Description

@jeremiedbb

I find the error message, raised when the number of features changes between calls to partial_fit in MiniBatchKMeans, a bit uninformative. See

from sklearn.cluster import MiniBatchKMeans
import numpy as np

X = np.random.random_sample((100,10))
mbk = MiniBatchKMeans()

mbk.partial_fit(X)
mbk.partial_fit(X[:,:-1])

>>> "ValueError: Incompatible dimension for X and Y matrices: X.shape[1] == 9 while Y.shape[1] == 10"

I understand that the error comes from a shape mismatch somewhere but it could be more informative (what is Y here ?), or am I just being too picky ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions