10000 remove some style errors in bench code. · raghavrv/scikit-learn@806cb22 · GitHub
[go: up one dir, main page]

Skip to content

Commit 806cb22

Browse files
committed
remove some style errors in bench code.
1 parent 613c3af commit 806cb22

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

benchmarks/bench_multilabel_metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def _plot(results, metrics, formats, title, x_ticks, x_label,
139139
ap = argparse.ArgumentParser()
140140
ap.add_argument('metrics', nargs='*', default=sorted(METRICS),
141141
help='Specifies metrics to benchmark, defaults to all. '
142-
'Choices are: '.format(sorted(METRICS)))
142+
'Choices are: {}'.format(sorted(METRICS)))
143143
ap.add_argument('--formats', nargs='+', choices=sorted(FORMATS),
144144
help='Specifies multilabel formats to benchmark '
145145
'(defaults to all).')

benchmarks/bench_sparsify.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def sparsity_ratio(X):
5858
X = np.random.randn(n_samples, n_features)
5959
inds = np.arange(n_samples)
6060
np.random.shuffle(inds)
61-
X[inds[n_features/1.2:]] = 0 # sparsify input
61+
X[inds[int(n_features / 1.2):]] = 0 # sparsify input
6262
print("input data sparsity: %f" % sparsity_ratio(X))
6363
coef = 3 * np.random.randn(n_features)
6464
inds = np.arange(n_features)
@@ -81,17 +81,18 @@ def sparsity_ratio(X):
8181
clf.fit(X_train, y_train)
8282
print("model sparsity: %f" % sparsity_ratio(clf.coef_))
8383

84-
@profile
84+
8585
def benchmark_dense_predict():
8686
for _ in range(300):
8787
clf.predict(X_test)
8888

89-
@profile
89+
9090
def benchmark_sparse_predict():
9191
X_test_sparse = csr_matrix(X_test)
9292
for _ in range(300):
9393
clf.predict(X_test_sparse)
9494

95+
9596
def score(y_test, y_pred, case):
9697
r2 = r2_score(y_test, y_pred)
9798
print("r^2 on test data (%s) : %f" % (case, r2))

0 commit comments

Comments
 (0)
0