|
26 | 26 | from sklearn.linear_model import LogisticRegression
|
27 | 27 |
|
28 | 28 | data, labels = load_iris(return_X_y=True)
|
29 |
| -baseline_lr = LogisticRegression(max_iter=110).fit(data, labels) |
| 29 | +baseline_lr = LogisticRegression(max_iter=1000).fit(data, labels) |
30 | 30 |
|
31 | 31 | # %%
|
32 | 32 | # Random data pruning
|
|
40 | 40 | def _random_pruning(X, y, n_samples_to_select: int, random_state: int):
|
41 | 41 | rng = np.random.default_rng(random_state)
|
42 | 42 | ids_random = rng.choice(y.size, n_samples_to_select, replace=False)
|
43 |
| - pruned_lr = LogisticRegression(max_iter=110).fit(X[ids_random], y[ids_random]) |
| 43 | + pruned_lr = LogisticRegression(max_iter=1000).fit(X[ids_random], y[ids_random]) |
44 | 44 | return pruned_lr.coef_, pruned_lr.intercept_
|
45 | 45 |
|
46 | 46 |
|
@@ -72,9 +72,9 @@ def _fastcan_pruning(
|
72 | 72 | ).fit(X)
|
73 | 73 | atoms = kmeans.cluster_centers_
|
74 | 74 | ids_fastcan = minibatch(
|
75 |
| - X.T, atoms.T, n_samples_to_select, batch_size=batch_size, tol=1e-9, verbose=0 |
| 75 | + X.T, atoms.T, n_samples_to_select, batch_size=batch_size, verbose=0 |
76 | 76 | )
|
77 |
| - pruned_lr = LogisticRegression(max_iter=110).fit(X[ids_fastcan], y[ids_fastcan]) |
| 77 | + pruned_lr = LogisticRegression(max_iter=1000).fit(X[ids_fastcan], y[ids_fastcan]) |
78 | 78 | print(atoms[-1], ids_fastcan[-10:])
|
79 | 79 | return pruned_lr.coef_, pruned_lr.intercept_
|
80 | 80 |
|
@@ -112,4 +112,4 @@ def plot_box(X, y, baseline, n_samples_to_select: int, n_random: int):
|
112 | 112 | plt.show()
|
113 | 113 |
|
114 | 114 |
|
115 |
| -plot_box(data, labels, baseline_lr, n_samples_to_select=100, n_random=10) |
| 115 | +plot_box(data, labels, baseline_lr, n_samples_to_select=100, n_random=100) |
0 commit comments