def _check_partial_fit_first_call(clf, classes=None):
 if ((getattr(clf, 'classes_', None) is None) and (classes is None)):
  raise ValueError('classes must be passed on the first call to partial_fit.')
 elif (classes is not None):
  if (getattr(clf, 'classes_', None) is not None):
   if (not array_equal(clf.classes_, unique_labels(classes))):
    raise ValueError(('`classes=%r` is not the same as on last call to partial_fit, was: %r' % (classes, clf.classes_)))
  else:
   clf.classes_ = unique_labels(classes)
   return True
 return False

def _check_partial_fit_first_call ( clf , classes = None ) : if ( ( getattr ( clf , 'classes_' , None ) is None ) and ( classes is None ) ) : raise ValueError ( 'classes must be passed on the first call to partial_fit.' ) elif ( classes is not None ) : if ( getattr ( clf , 'classes_' , None ) is not None ) : if ( not array_equal ( clf . classes_ , unique_labels ( classes ) ) ) : raise ValueError ( ( '`classes=%r` is not the same as on last call to partial_fit, was: %r' % ( classes , clf . classes_ ) ) ) else : clf . classes_ = unique_labels ( classes ) return True return False
private helper function for factorizing common classes param logic estimators that implement the partial_fit api need to be provided with the list of possible classes at the first call to partial_fit .