|
16 | 16 | from sklearn.model_selection import cross_val_score |
17 | 17 |
|
18 | 18 | rng = np.random.RandomState(42) |
19 | | - |
| 19 | +x_label = "Number of features" |
20 | 20 | dimensions = np.linspace(50, 5000, num=8).astype(int) |
21 | 21 | sample_sizes = np.linspace(50, 5000, num=8).astype(int) |
22 | 22 | accuracies = [] |
|
42 | 42 |
|
43 | 43 | fig, axs = plt.subplots(2, 2) |
44 | 44 | axs[0, 0].plot(dimensions, accuracies) |
45 | | -axs[0, 0].set_xlabel("Number of features") |
| 45 | +axs[0, 0].set_xlabel(x_label) |
46 | 46 | axs[0, 0].set_ylabel("accuracy") |
47 | 47 | axs[0, 1].plot(dimensions, times) |
48 | | -axs[0, 1].set_xlabel("Number of features") |
| 48 | +axs[0, 1].set_xlabel(x_label) |
49 | 49 | axs[0, 1].set_ylabel("Time to fit and predict (s)") |
50 | 50 |
|
51 | 51 | accuracies = [] |
|
66 | 66 | times.append(time() - stime) |
67 | 67 |
|
68 | 68 | axs[1, 0].plot(dimensions, accuracies) |
69 | | -axs[1, 0].set_xlabel("Number of features") |
| 69 | +axs[1, 0].set_xlabel(x_label) |
70 | 70 | axs[1, 0].set_ylabel("accuracy") |
71 | 71 | axs[1, 1].plot(dimensions, times) |
72 | | -axs[1, 1].set_xlabel("Number of features") |
| 72 | +axs[1, 1].set_xlabel(x_label) |
73 | 73 | axs[1, 1].set_ylabel("Time to fit and predict (s)") |
74 | 74 |
|
75 | 75 |
|
|
0 commit comments