Skip to content

Commit 266de5c

Browse files
authored
EXA Add a variable instead of repeating the same string literal (#68)
1 parent 5228f05 commit 266de5c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

benchmarks/_bench/robust_plot_synthetic.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from sklearn.model_selection import cross_val_score
1717

1818
rng = np.random.RandomState(42)
19-
19+
x_label = "Number of features"
2020
dimensions = np.linspace(50, 5000, num=8).astype(int)
2121
sample_sizes = np.linspace(50, 5000, num=8).astype(int)
2222
accuracies = []
@@ -42,10 +42,10 @@
4242

4343
fig, axs = plt.subplots(2, 2)
4444
axs[0, 0].plot(dimensions, accuracies)
45-
axs[0, 0].set_xlabel("Number of features")
45+
axs[0, 0].set_xlabel(x_label)
4646
axs[0, 0].set_ylabel("accuracy")
4747
axs[0, 1].plot(dimensions, times)
48-
axs[0, 1].set_xlabel("Number of features")
48+
axs[0, 1].set_xlabel(x_label)
4949
axs[0, 1].set_ylabel("Time to fit and predict (s)")
5050

5151
accuracies = []
@@ -66,10 +66,10 @@
6666
times.append(time() - stime)
6767

6868
axs[1, 0].plot(dimensions, accuracies)
69-
axs[1, 0].set_xlabel("Number of features")
69+
axs[1, 0].set_xlabel(x_label)
7070
axs[1, 0].set_ylabel("accuracy")
7171
axs[1, 1].plot(dimensions, times)
72-
axs[1, 1].set_xlabel("Number of features")
72+
axs[1, 1].set_xlabel(x_label)
7373
axs[1, 1].set_ylabel("Time to fit and predict (s)")
7474

7575

0 commit comments

Comments
 (0)