def _fit_binary(estimator, X, y, classes=None):
 unique_y = np.unique(y)
 if (len(unique_y) == 1):
  if (classes is not None):
   if (y[0] == (-1)):
    c = 0
   else:
    c = y[0]
   warnings.warn(('Label %s is present in all training examples.' % str(classes[c])))
  estimator = _ConstantPredictor().fit(X, unique_y)
 else:
  estimator = clone(estimator)
  estimator.fit(X, y)
 return estimator

def _fit_binary ( estimator , X , y , classes = None ) : unique_y = np . unique ( y ) if ( len ( unique_y ) == 1 ) : if ( classes is not None ) : if ( y [ 0 ] == ( - 1 ) ) : c = 0 else : c = y [ 0 ] warnings . warn ( ( 'Label %s is present in all training examples.' % str ( classes [ c ] ) ) ) estimator = _ConstantPredictor ( ) . fit ( X , unique_y ) else : estimator = clone ( estimator ) estimator . fit ( X , y ) return estimator
fit a single binary estimator .