def _incremental_fit_estimator(estimator, X, y, classes, train, test, train_sizes, scorer, verbose):
 (train_scores, test_scores) = ([], [])
 partitions = zip(train_sizes, np.split(train, train_sizes)[:(-1)])
 for (n_train_samples, partial_train) in partitions:
  train_subset = train[:n_train_samples]
  (X_train, y_train) = _safe_split(estimator, X, y, train_subset)
  (X_partial_train, y_partial_train) = _safe_split(estimator, X, y, partial_train)
  (X_test, y_test) = _safe_split(estimator, X, y, test, train_subset)
  if (y_partial_train is None):
   estimator.partial_fit(X_partial_train, classes=classes)
  else:
   estimator.partial_fit(X_partial_train, y_partial_train, classes=classes)
  train_scores.append(_score(estimator, X_train, y_train, scorer))
  test_scores.append(_score(estimator, X_test, y_test, scorer))
 return np.array((train_scores, test_scores)).T

def _incremental_fit_estimator ( estimator , X , y , classes , train , test , train_sizes , scorer , verbose ) : ( train_scores , test_scores ) = ( [ ] , [ ] ) partitions = zip ( train_sizes , np . split ( train , train_sizes ) [ : ( - 1 ) ] ) for ( n_train_samples , partial_train ) in partitions : train_subset = train [ : n_train_samples ] ( X_train , y_train ) = _safe_split ( estimator , X , y , train_subset ) ( X_partial_train , y_partial_train ) = _safe_split ( estimator , X , y , partial_train ) ( X_test , y_test ) = _safe_split ( estimator , X , y , test , train_subset ) if ( y_partial_train is None ) : estimator . partial_fit ( X_partial_train , classes = classes ) else : estimator . partial_fit ( X_partial_train , y_partial_train , classes = classes ) train_scores . append ( _score ( estimator , X_train , y_train , scorer ) ) test_scores . append ( _score ( estimator , X_test , y_test , scorer ) ) return np . array ( ( train_scores , test_scores ) ) . T
train estimator on training subsets incrementally and compute scores .