Skip to content

Commit

Permalink
EXA change max_iter and enable early_stopping to get rid of convergen…
Browse files Browse the repository at this point in the history
…ce warning in plot_mlp_alpha (#16260)
  • Loading branch information
TiphaineV committed Jan 30, 2020
1 parent 034c021 commit d2b8542
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions examples/neural_networks/plot_mlp_alpha.py
Expand Up @@ -28,6 +28,7 @@
from sklearn.preprocessing import StandardScaler
from sklearn.datasets import make_moons, make_circles, make_classification
from sklearn.neural_network import MLPClassifier
from sklearn.pipeline import make_pipeline

h = .02 # step size in the mesh

Expand All @@ -36,8 +37,13 @@

classifiers = []
for i in alphas:
classifiers.append(MLPClassifier(solver='lbfgs', alpha=i, random_state=1,
hidden_layer_sizes=[100, 100]))
classifiers.append(make_pipeline(
StandardScaler(),
MLPClassifier(solver='lbfgs', alpha=i,
random_state=1, max_iter=2000,
early_stopping=True,
hidden_layer_sizes=[100, 100])
))

X, y = make_classification(n_features=2, n_redundant=0, n_informative=2,
random_state=0, n_clusters_per_class=1)
Expand Down

0 comments on commit d2b8542

Please sign in to comment.