We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0526c7d commit d7ddffeCopy full SHA for d7ddffe
examples/model_selection/plot_randomized_search.py
@@ -31,7 +31,7 @@
31
from sklearn.linear_model import SGDClassifier
32
33
# get some data
34
-X, y = load_digits(return_X_y=True)
+X, y = load_digits(return_X_y=True, n_class=3)
35
36
# build a classifier
37
clf = SGDClassifier(loss="hinge", penalty="elasticnet", fit_intercept=True)
@@ -57,11 +57,11 @@ def report(results, n_top=3):
57
param_dist = {
58
"average": [True, False],
59
"l1_ratio": stats.uniform(0, 1),
60
- "alpha": loguniform(1e-4, 1e0),
+ "alpha": loguniform(1e-2, 1e0),
61
}
62
63
# run randomized search
64
-n_iter_search = 20
+n_iter_search = 15
65
random_search = RandomizedSearchCV(
66
clf, param_distributions=param_dist, n_iter=n_iter_search
67
)
@@ -78,7 +78,7 @@ def report(results, n_top=3):
78
param_grid = {
79
80
"l1_ratio": np.linspace(0, 1, num=10),
81
- "alpha": np.power(10, np.arange(-4, 1, dtype=float)),
+ "alpha": np.power(10, np.arange(-2, 1, dtype=float)),
82
83
84
# run grid search
0 commit comments