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

[IDEA] Chapter 2, Reduce multiple FutureWarning(s) when using KMeans with sklearn 1.3.1 #104

Open
eranr opened this issue Nov 8, 2023 · 0 comments

Comments

@eranr
Copy link

eranr commented Nov 8, 2023

Notebook name: 02_end_to_end_machine_learning_project
Section 3.4: “Custom Transformers”
cell 109

The definition of the ClusterSimilarity transformer yields quite a few “FutureWarning” warnings with sklearn 1.3.1. The warning comes from the “fit” method which initiates the KMeans class without an n_init parameter. To resolve replace:

self.kmeans_ = KMeans(self.n_clusters, random_state=self.random_state)

with:

self.kmeans_ = KMeans(self.n_clusters, random_state=self.random_state, n_init='auto')
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