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

Using 'predict' method always returns the same cluster no matter the input #50

Closed
tjomk opened this issue Jul 24, 2017 · 1 comment
Closed

Comments

@tjomk
Copy link

tjomk commented Jul 24, 2017

I am probably doing something wrong.

I have categorical data, in total ~1600 points. I split it to train and test, then clusterise it. It works well. But when I try to fit the train data to any cluster, it always returns 0.

from sklearn.model_selection import train_test_split

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=10)

km = kmodes.KModes(n_clusters=50, init='Huang', num_runs=5, verbose=1)
clusters = km.fit_predict(X_train)

The above works fine and the results are great, however the below code returns all zeroes:

test_data_clusters = km.predict(X_test)

Am I misunderstanding the predict function and doing something wrong?

@tjomk tjomk closed this as completed Jul 24, 2017
@tjomk
Copy link
Author

tjomk commented Jul 24, 2017

Sorry, my bad and everything actually works as expected :) Thanks for the awesome library!

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

1 participant