Skip to content

Use random state to initialize MLPClassifier.#12892

Merged
qinhanmin2014 merged 11 commits intoscikit-learn:masterfrom
xhan7279:test_predict_proba_random_seed_fix
Jan 27, 2019
Merged

Use random state to initialize MLPClassifier.#12892
qinhanmin2014 merged 11 commits intoscikit-learn:masterfrom
xhan7279:test_predict_proba_random_seed_fix

Conversation

@xhan7279
Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Fixes #12762

What does this implement/fix? Explain your changes.

The test failed if the random seed is changed. Initialize MLP Classifier with a random state seems to resolve the issue.

Any other comments?

Copy link
Copy Markdown
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

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

We still ordinarily use a fixed random_state in tests

with ignore_warnings(category=ConvergenceWarning):
clf.fit(X, y)
clf = MLPClassifier(hidden_layer_sizes=5, activation='logistic'
random_stat=1)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is a typo in random_state and a comma missing before this parameter.

@jnothman
Copy link
Copy Markdown
Member

Please merge updated master to avoid the circle ci failure. Let us know if you need help with that. Thanks

@qinhanmin2014
Copy link
Copy Markdown
Member

Hmm, I'm still getting ConvergenceWarning?

System:
python: 3.6.3 |Anaconda custom (64-bit)| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)]
executable: D:\ProgramData\Anaconda3\python.exe
machine: Windows-10-10.0.17134-SP0

BLAS:
macros: SCIPY_MKL_H=None, HAVE_CBLAS=None
lib_dirs: D:\ProgramData\Anaconda3\Library\lib
cblas_libs: mkl_rt

Python deps:
pip: 18.1
setuptools: 40.5.0
sklearn: 0.21.dev0
numpy: 1.15.4
scipy: 1.2.0
Cython: 0.29.2
pandas: 0.23.4

@qinhanmin2014
Copy link
Copy Markdown
Member

I think it's reasonable to keep the ConvergenceWarning, will mere when green.

@qinhanmin2014 qinhanmin2014 merged commit 3207278 into scikit-learn:master Jan 27, 2019
@qinhanmin2014
Copy link
Copy Markdown
Member

thanks @xhan7279

@xhan7279
Copy link
Copy Markdown
Contributor Author

thanks everyone for helping me out =)

@xhan7279 xhan7279 deleted the test_predict_proba_random_seed_fix branch January 27, 2019 15:30
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Jan 30, 2019
thomasjpfan pushed a commit to thomasjpfan/scikit-learn that referenced this pull request Feb 6, 2019
thomasjpfan pushed a commit to thomasjpfan/scikit-learn that referenced this pull request Feb 7, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
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

Successfully merging this pull request may close these issues.

TST: test_predict_proba_binary fails for some random seed

5 participants