Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BF: k-fold should accept k==n

  • Loading branch information...
commit 012d0d4c3ee9f2aeb53589ffcd941c2889765591 1 parent 9ee7f61
@satra satra authored GaelVaroquaux committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 scikits/learn/cross_val.py
View
4 scikits/learn/cross_val.py
@@ -174,7 +174,7 @@ def __init__(self, n, k):
All the folds have size trunc(n/k), the last one has the complementary
"""
assert k>0, ('cannot have k below 1')
- assert k<n, ('cannot have k=%d greater than the number '
+ assert k<=n, ('cannot have k=%d greater than the number '
'of samples: %d'% (k, n))
self.n = n
self.k = k
@@ -251,7 +251,7 @@ def __init__(self, y, k):
y = np.asanyarray(y)
n = y.shape[0]
assert k>0, ValueError('cannot have k below 1')
- assert k<n, ValueError('cannot have k=%d greater than the number '
+ assert k<=n, ValueError('cannot have k=%d greater than the number '
'of samples %d' % (k, n))
_, y_sorted = unique(y, return_inverse=True)
assert k <= np.min(np.bincount(y_sorted))
Please sign in to comment.
Something went wrong with that request. Please try again.