question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`random_state` must be a RandomState instance

See original GitHub issue

https://github.com/scikit-learn/scikit-learn/blob/4d5407c89fb2b25ef5cba90470cbdaecf10064cc/sklearn/cluster/_kmeans.py#L56

This is a private function, so it’s maybe not a big deal, but I wanted to point out that the parameter random_state to _k_init() must be a RandomState instance, it can not be an integer. So, the documentation of this parameter is wrong on the docstrings of _k_init().

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
glemaitrecommented, Jan 2, 2020

yes 👍

On Thu, 2 Jan 2020 at 18:43, Manish Aradwad notifications@github.com wrote:

I’ll do this one… Just for clarification, I should change the line random_state : int, RandomState instance to random_state : RandomState instance and update the documentation below it, right??

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/scikit-learn/scikit-learn/issues/16004?email_source=notifications&email_token=ABY32P253PFLQR5GVPPXSQ3Q3YRUTA5CNFSM4KCCTTKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH65LTA#issuecomment-570283468, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABY32P6PN2KEQLIAM2BEZADQ3YRUTANCNFSM4KCCTTKA .

– Guillaume Lemaitre Scikit-learn @ Inria Foundation https://glemaitre.github.io/

0reactions
glemaitrecommented, Jan 3, 2020

Closing after merging the PR. Thanks for reporting.

Read more comments on GitHub >

github_iconTop Results From Across the Web

numpy.random.RandomState — NumPy v1.16 Manual
RandomState exposes a number of methods for generating random numbers drawn from a variety of probability distributions. In addition to the distribution- ...
Read more >
python - Difference between np.random.seed() and np ...
RandomState () constructs a random number generator. It does not have any effect on the freestanding functions in np.random , but must be ......
Read more >
Add RandomState support for the sklearn wrapper · Issue #730
If random_state is a RandomState instance, call get_state() and derive from the returned value (how?) a seed for the c++ code. Ideally we...
Read more >
Error: ValueError('%r cannot be used to seed a numpy.random ...
If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If ...
Read more >
Why do we set a random state in machine learning models?
You may already use random state in your machine learning models. ... This allows the function to use the global random state instance...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found