Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fitting the k-means-constrained on training samples and predicting on test samples raises error #19

Closed
bweill555 opened this issue Feb 20, 2022 · 2 comments

Comments

@bweill555
Copy link

Hi,
I'm trying to fit the k-means-constrained on training samples and then call it to predict test samples. I am getting the following error message:

~\anaconda3\lib\site-packages\k_means_constrained\k_means_constrained_.py in predict(self, X, size_min, size_max)
708 raise ValueError("size_max must be larger than size_min")
709 if size_min * n_clusters > n_samples:
--> 710 raise ValueError("The product of size_min and n_clusters cannot exceed the number of samples (X)")
711
712 labels, inertia = \

ValueError: The product of size_min and n_clusters cannot exceed the number of samples (X)

It seems there is not enough data in the testing sample to meet the clusters size constraints (here size_min) but is there a way to only apply the clusters sizes constrains in the fitting process and not in the prediction one?

@joshlk
Copy link
Owner

joshlk commented Mar 10, 2022

Hey, thanks for using k-means-constrained! Can you give show me the full code example of what you are doing and the shapes of the input data?

@joshlk
Copy link
Owner

joshlk commented Apr 13, 2022

I’m going to close the issue due to inactivity. @bweill555 feel free to reopen if you are still having issues

@joshlk joshlk closed this as completed Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants