Skip to content

Commit 48adf8b

Browse files
committed
Use a single vstack for concatenating all blocks in prediction matrix
1 parent aa2d6bf commit 48adf8b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

sklearn/cross_validation.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,9 +1050,7 @@ def cross_val_predict(estimator, X, y=None, cv=None, n_jobs=1,
10501050

10511051
# Check for sparse predictions
10521052
if sp.issparse(p[0]) :
1053-
preds = p[0]
1054-
for i in range(1,len(p)):
1055-
preds = sp.vstack((preds, p[i]), format = 'csr')
1053+
preds = sp.vstack(p, format = 'csr')
10561054
return preds
10571055
else :
10581056
p = np.concatenate(p)

0 commit comments

Comments
 (0)