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

Use random_state parameter in KMeans clustering for reproducibility #834

Merged
merged 3 commits into from
Nov 17, 2022

Conversation

alex-l-kong
Copy link
Contributor

What is the purpose of this PR?

Closes #812. Adds a random seed to KMeans clustering in neighborhood analysis to ensure reproducible results.

How did you implement your changes

Pass a seed parameter to the cluster metrics and assignment functions of neighborhood analysis, which is analogous with random_state in sklearn.cluster.KMeans and pd.DataFrame.sample.

@alex-l-kong alex-l-kong self-assigned this Nov 16, 2022
Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you run through the whole notebook with the same data twice to make sure you can replicate the same output?

@alex-l-kong
Copy link
Contributor Author

alex-l-kong commented Nov 17, 2022 via email

Copy link
Contributor

@cliu72 cliu72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@ngreenwald ngreenwald merged commit e1af451 into main Nov 17, 2022
@ngreenwald ngreenwald deleted the kmeans_seed branch November 17, 2022 21:30
@srivarra srivarra added the enhancement New feature or request label Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow for random_state parameter passing to neighborhood analysis KMeans functions
4 participants