Skip to content

Commit f4b11cd

Browse files
committed
deprecate make_blobs, use sklearn make_blobs in plot_metrics
1 parent f05d1d6 commit f4b11cd

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

mglearn/make_blobs.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
from sklearn.utils import check_array, check_random_state
55
from sklearn.utils import shuffle as shuffle_
6+
from sklearn.utils.deprecation import deprecated
67

78

9+
@deprecated("Please import make_blobs directly from scikit-learn")
810
def make_blobs(n_samples=100, n_features=2, centers=2, cluster_std=1.0,
911
center_box=(-10.0, 10.0), shuffle=True, random_state=None):
1012
"""Generate isotropic Gaussian blobs for clustering.

mglearn/plot_grid_search.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ def plot_cross_val_selection():
1414

1515
param_grid = {'C': [0.001, 0.01, 0.1, 1, 10, 100],
1616
'gamma': [0.001, 0.01, 0.1, 1, 10, 100]}
17-
grid_search = GridSearchCV(SVC(), param_grid, cv=5)
17+
grid_search = GridSearchCV(SVC(), param_grid, cv=5,
18+
return_train_score=True)
1819
grid_search.fit(X_trainval, y_trainval)
1920
results = pd.DataFrame(grid_search.cv_results_)[15:]
2021

mglearn/plot_metrics.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ def plot_binary_confusion_matrix():
3636

3737

3838
def plot_decision_threshold():
39-
from mglearn.datasets import make_blobs
39+
from sklearn.datasets import make_blobs
4040
from sklearn.svm import SVC
4141
from sklearn.model_selection import train_test_split
4242

43-
X, y = make_blobs(n_samples=(400, 50), centers=2, cluster_std=[7.0, 2],
43+
X, y = make_blobs(n_samples=(400, 50), cluster_std=[7.0, 2],
4444
random_state=22)
4545
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)
4646

0 commit comments

Comments
 (0)