title: Using learning_curve in scikit-learn (Python)
body: <p>I'm running scikit-learn (0.15) in Python 2.7.6.</p>
  
  <p>I have a training set (X) that is 33x3 (33 records, 3 features), and a target (y) that is 33x1.  I'm trying to use the learning_curve function (from sklearn.learning_curve import learning_curve) on this dataset.  </p>
  
  <p>Here is the value for X:</p>
  
  <pre><code>array([[ 1.        , -0.12493874,  0.04575749],
         [ 0.        , -0.30103   ,  0.03140846],
         [ 1.        , -0.17609126,  0.11394335],
         [ 1.        , -0.30103   , -0.06694679],
         [ 1.        , -0.30103   , -0.12104369],
         [ 1.        , -0.23408321,  0.11270428],
         [ 1.        ,  0.19188553,  0.22577904],
         [ 1.        , -0.23736092, -0.42100531],
         [ 0.        ,  0.21085337,  0.13966199],
         [ 1.        , -0.06214791,  0.07716595],
         [ 1.        ,  0.14612804, -0.01223446],
         [ 1.        ,  0.1383027 ,  0.1217336 ],
         [ 1.        , -0.30103   , -0.18073616],
         [ 0.        ,  0.02996322, -0.09108047],
         [ 0.        ,  0.05435766,  0.1638568 ],
         [ 1.        , -0.11394335,  0.        ],
         [ 1.        ,  0.06694679,  0.30998484],
         [ 0.        ,  0.64345268,  0.02802872],
         [ 1.        ,  0.        , -0.01639042],
         [ 0.        ,  0.11394335, -0.0234811 ],
         [ 0.        ,  0.        ,  0.18799048],
         [ 1.        ,  0.        ,  0.10914447],
         [ 1.        , -0.04139269,  0.        ],
         [ 0.        ,  0.18905624,  0.17026172],
         [ 1.        , -0.14132915,  0.15209098],
         [ 0.        ,  0.30103   ,  0.27036118],
         [ 1.        ,  0.22184875,  0.05435766],
         [ 0.        ,  0.34242268,  0.09455611],
         [ 1.        , -0.20411998, -0.1173856 ],
         [ 0.        ,  0.11394335,  0.01189922],
         [ 1.        , -0.22184875, -0.01378828],
         [ 1.        ,  0.13262557,  0.14390658],
         [ 0.        ,  0.14612804,  0.13353891]])
  </code></pre>
  
  <p>And for y:</p>
  
  <pre><code>array([1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1,
         0, 1, 0, 0, 0, 1, 0, 1, 0, 0])
  </code></pre>
  
  <p>When I enter:</p>
  
  <pre><code>Gmodel=GaussianNB()
  learning_curve(Gmodel,X,y,train_sizes=[3,6,10],cv=3)
  </code></pre>
  
  <p>I get the following error:  What am I doing wrong?</p>
  
  <pre><code>---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-143-f7cccd85f1fe&gt; in &lt;module&gt;()
  ----&gt; 1 learning_curve(Gmodel,train_all,target,train_sizes=[3,6,10],cv=3)
  
  /Users/***/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/learning_curve.pyc in learning_curve(estimator, X, y, train_sizes, cv, scoring, exploit_incremental_learning, n_jobs, pre_dispatch, verbose)
      131             clone(estimator), X, y, scorer, train[:n_train_samples], test,
      132             verbose, parameters=None, fit_params=None, return_train_score=True)
  --&gt; 133             for train, test in cv for n_train_samples in train_sizes_abs)
      134         out = np.array(out)[:, :2]
      135         n_cv_folds = out.shape[0] // n_unique_ticks
  
  /Users/***/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in __call__(self, iterable)
      642             self._iterating = True
      643             for function, args, kwargs in iterable:
  --&gt; 644                 self.dispatch(function, args, kwargs)
      645 
      646             if pre_dispatch == "all" or n_jobs == 1:
  
  /Users/***/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in dispatch(self, func, args, kwargs)
      389         """
      390         if self._pool is None:
  --&gt; 391             job = ImmediateApply(func, args, kwargs)
      392             index = len(self._jobs)
      393             if not _verbosity_filter(index, self.verbose):
  
  /Users/***/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in __init__(self, func, args, kwargs)
      127         # Don't delay the application, to avoid keeping the input
      128         # arguments in memory
  --&gt; 129         self.results = func(*args, **kwargs)
      130 
      131     def get(self):
  
  /Users/***/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/cross_validation.pyc in _fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters, fit_params, return_train_score, return_parameters)
     1195     start_time = time.time()
     1196 
  -&gt; 1197     X_train, y_train = _safe_split(estimator, X, y, train)
     1198     X_test, y_test = _safe_split(estimator, X, y, test, train)
     1199     if y_train is None:
  
  /Users/***/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/cross_validation.pyc in _safe_split(estimator, X, y, indices, train_indices)
     1245 
     1246     if y is not None:
  -&gt; 1247         y_subset = y[safe_mask(y, indices)]
     1248     else:
     1249         y_subset = None
  
  TypeError: only integer arrays with one element can be converted to an index 
  </code></pre>