def METHOD_NAME(self, y):
    class_nums = len(np.unique(y))
    if not self.multi_class:
        if class_nums != 2 and self.loss == 'binary_crossentropy':
            raise ValueError("Can not use binary classification with more or less than two target classes.")
        self.target_dimension = 1
    else:
        self.target_dimension = len(np.unique(y))