|
28 | 28 | from sklearn.datasets import make_blobs
|
29 | 29 |
|
30 | 30 | X, y = make_blobs(n_samples=[950, 50], centers=((-3, 0), (3, 0)), random_state=10)
|
31 |
| -plt.scatter(X[:, 0], X[:, 1], c=y) |
| 31 | +_ = plt.scatter(X[:, 0], X[:, 1], c=y) |
32 | 32 |
|
33 | 33 | # %%
|
34 | 34 | # To introduce instance hardness in our dataset, we add some hard to classify samples:
|
35 | 35 | X_hard, y_hard = make_blobs(
|
36 | 36 | n_samples=10, centers=((3, 0), (-3, 0)), cluster_std=1, random_state=10
|
37 | 37 | )
|
38 | 38 | X, y = np.vstack((X, X_hard)), np.hstack((y, y_hard))
|
39 |
| -plt.scatter(X[:, 0], X[:, 1], c=y) |
| 39 | +_ = plt.scatter(X[:, 0], X[:, 1], c=y) |
40 | 40 |
|
41 | 41 | # %%
|
42 | 42 | # Compare cross validation scores using `StratifiedKFold` and `InstanceHardnessCV`
|
|
69 | 69 | results = {}
|
70 | 70 | for cv in (
|
71 | 71 | StratifiedKFold(n_splits=5, shuffle=True, random_state=10),
|
72 |
| - InstanceHardnessCV(estimator=LogisticRegression(), n_splits=5, random_state=10), |
| 72 | + InstanceHardnessCV(estimator=LogisticRegression()), |
73 | 73 | ):
|
74 | 74 | result = cross_validate(
|
75 | 75 | logistic_regression,
|
|
83 | 83 |
|
84 | 84 | # %%
|
85 | 85 | ax = results.plot.box(vert=False, whis=[0, 100])
|
86 |
| -ax.set( |
| 86 | +_ = ax.set( |
87 | 87 | xlabel="Average precision",
|
88 | 88 | title="Cross validation scores with different splitters",
|
89 | 89 | xlim=(0, 1),
|
|
0 commit comments