xpectra.AbstainingClassifier
- class xpectra.AbstainingClassifier(model, scorer)[source]
Bases:
objectPredict a class when the OOD score is below tau, otherwise abstain.
- Parameters:
scorer (OODScorer)
Methods
__init__(model, scorer)Fraction of X that would be classified (not abstained) at the current tau.
fit_tau(X_val[, target_coverage])Set tau so that target_coverage of X_val falls below it.
predict(X, class_names)Attributes
- ABSTAIN = 'ABSTAIN'
- fit_tau(X_val, target_coverage=0.9)[source]
Set tau so that target_coverage of X_val falls below it.
X_val must be a HELD-OUT labeled set that neither the model nor the scorer was trained on — calibrating on in-sample data yields optimistic scores and a threshold too tight to hit the target coverage on new data.
- Parameters:
- Return type: