10000 P3K fix broken doctest and add forgotten print_function import · amueller/scikit-learn@c481ff8 · GitHub
[go: up one dir, main page]

Skip to content

Commit c481ff8

Browse files
committed
P3K fix broken doctest and add forgotten print_function import
1 parent 85ec0fd commit c481ff8

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

benchmarks/bench_plot_nmf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Benchmarks of Non-Negative Matrix Factorization
33
"""
44

5+
from __future__ import print_function
6+
57
import gc
68
from time import time
79
import numpy as np

doc/modules/cross_validation.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Example of 2-fold::
162162
sklearn.cross_validation.KFold(n=4, n_folds=2)
163163

164164
>>> for train, test in kf:
165-
... print(train, test)
165+
... print("%s %s" % (train, test))
166166
[False False True True] [ True True False False]
167167
[ True True False False] [False False True True]
168168

@@ -181,7 +181,7 @@ when creating the cross-validation procedure::
181181

182182
>>> kf = KFold(len(Y), n_folds=2, indices=True)
183183
>>> for train, test in kf:
184-
... print(train, test)
184+
... print("%s %s" % (train, test))
185185
[2 3] [0 1]
186186
[0 1] [2 3]
187187

@@ -210,7 +210,7 @@ Example of stratified 2-fold::
210210
sklearn.cross_validation.StratifiedKFold(labels=[0 0 0 1 1 1 0], n_folds=2)
211211

212212
>>> for train, test in skf:
213-
... print(train, test)
213+
... print("%s %s" % (train, test))
214214
[1 4 6] [0 2 3 5]
215215
[0 2 3 5] [1 4 6]
216216

@@ -233,7 +233,7 @@ not waste much data as only one sample is removed from the learning set::
233233
sklearn.cross_validation.LeaveOneOut(n=4)
234234

235235
>>> for train, test in loo:
236-
... print(train, test)
236+
... print("%s %s" % (train, test))
237237
[1 2 3] [0]
238238
[0 2 3] [1]
239239
[0 1 3] [2]
@@ -257,7 +257,7 @@ Example of Leave-2-Out::
257257
sklearn.cross_validation.LeavePOut(n=4, p=2)
258258

259259
>>> for train, test in lpo:
260-
... print(train, test)
260+
... print("%s %s" % (train, test))
261261
[2 3] [0 1]
262262
[1 3] [0 2]
263263
[1 2] [0 3]
@@ -291,7 +291,7 @@ a training set using the samples of all the experiments except one::
291291
sklearn.cross_validation.LeaveOneLabelOut(labels=[1, 1, 2, 2])
292292

293293
>>> for train, test in lolo:
294-
... print(train, test)
294+
... print("%s %s" % (train, test))
295295
[2 3] [0 1]
296296
[0 1] [2 3]
297297

@@ -318,7 +318,7 @@ Example of Leave-2-Label Out::
318318
sklearn.cross_validation.LeavePLabelOut(labels=[1, 1, 2, 2, 3, 3], p=2)
319319

320320
>>> for train, test in lplo:
321-
... print(train, test)
321+
... print("%s %s" % (train, test))
322322
[4 5] [0 1 2 3]
323323
[2 3] [0 1 4 5]
324324
[0 1] [2 3 4 5]
@@ -348,7 +348,7 @@ Here is a usage example::
348348
ShuffleSplit(5, n_iter=3, test_size=0.25, indices=True, ...)
349349

350350
>>> for train_index, test_index in ss:
351-
... print(train_index, test_index)
351+
... print("%s %s" % (train_index, test_index))
352352
...
353353
[1 3 4] [2 0]
354354
[1 4 3] [0 2]
@@ -394,7 +394,7 @@ smaller than the total dataset if it is very large.
394394
Bootstrap(9, n_iter=3, train_size=5, test_size=4, random_state=0)
395395

396396
>>> for train_index, test_index in bs:
397-
... print(train_index, test_index)
397+
... print("%s %s" % (train_index, test_index))
398398
...
399399
[1 8 7 7 8] [0 3 0 5]
400400
[5 4 2 4 2] [6 7 1 0]

0 commit comments

Comments
 (0)
0