GRMLinearClassifier

class scikit_weak.classification.GRMLinearClassifier(loss='logistic', max_epochs=100, optimizer='sgd', random_state=None, regularizer=None, l1=0.01, l2=0.01, batch_size=32)

A class to perform classification for weakly supervised data, based on the Generalized Risk Minimization Paradigm applied to linear classifiers (either, logistic regression or linear SVM). The y input to the fit method should be given as an iterable of DiscreteWeakLabel

Parameters
  • loss (str or callable, default 'logistic') – The loss function to optimize

  • max_epochs (int, default 100) – The number of epochs to train the model

  • optimizer (str or callable, default 'sgd') – The optimizer algorithm

  • regularizer (str or callable, default None) – The type of regularization to apply

  • l1 (float, default 0.01) – The regularization coefficient for l1 regularization, used only if regularizer=’l1’

  • l2 (float, default 0.01) – The regularization coefficient for l2 regularization, used only if regularizer=’l2’

  • batch_size (int, default 32) – Size of the mini-batches

Variables
  • regularization – The regularization method instance

  • model (tf.keras.Model) – The fitted linear model

  • loss_funct (callable) – The loss function callable

  • __n_classes (int) – The number of unique classes in y

  • __classes (list of int) – The unique classes in y

fit(X, y)

Fit the GRMLinearClassifier model

predict(X)

Returns predictions for the given X

predict_proba(X)

Returns probability distributions for the given X

References

[1] Hüllermeier, E. (2014).

Learning from imprecise and fuzzy observations: Data disambiguation through generalized loss minimization. International Journal of Approximate Reasoning, 55(7), 1519-1534. https://doi.org/10.1016/j.ijar.2013.09.003