LabelRelaxationNNClassifier

class scikit_weak.classification.LabelRelaxationNNClassifier(lr_alpha: float = 0.1, hidden_layer_sizes: tuple = (100,), activation: str = 'relu', l2_penalty: float = 0.0001, learning_rate: float = 0.001, momentum: float = 0.0, epochs: int = 100, batch_size: Optional[int] = None, provide_alphas: bool = False, n_classes: Optional[int] = None)

Simple MLP-based classifier using the label relaxation loss as optimization criterion.

Parameters
  • lr_alpha (float, default=0.1) – Imprecisiation degree alpha of the label relaxation loss

  • hidden_layer_sizes (tuple, default=(100,)) – Tuple consisting of the individual hidden layer sizes used by the underlying NN model

  • activation (str, default 'relu') – Activation function applied to the hidden layers’ activations

  • l2_penalty (float, default=1e-4) – L2 norm regularization parameter applied to all neural network layers

  • learning_rate (float, default=1e-3) – Learning rate used by the SGD optimizer

  • momentum (float, default=0.0) – Momentum used by the SGD optimizer

  • epochs (int, default=100) – Number of training epochs

  • batch_size (int, default=None) – Batch size for training

  • provide_alphas (bool, default=False) – Indicator whether we consider tuples as targets consisting of the classes and their imprecisiation

  • n_classes (int default=None) – Number of classes in case we want to be certain about the dimensionality of the one-hot encoding

fit(X, y)

Fits the label relaxation model. The targets y are one-hot encoded in case a simple list is provided.

References

[1] Lienen, J., Hüllermeier, E. (2021).

From label smoothing to label relaxation. Proceedings of the 35th AAAI Conference on Artificial Intelligence, AAAI.