Skip to content

Instantly share code, notes, and snippets.

@kmdupr33
Created December 15, 2022 20:39
Show Gist options
  • Save kmdupr33/26dc76f282d16b36aa8bf917c8138e92 to your computer and use it in GitHub Desktop.
Save kmdupr33/26dc76f282d16b36aa8bf917c8138e92 to your computer and use it in GitHub Desktop.
def show_doubt_if_modeling():
global _o_predicates
if 'model' in dc_code and 'X' in dc_code and 'y' in dc_code:
from doubtlab.ensemble import DoubtEnsemble
from doubtlab.reason import ProbaReason, WrongPredictionReason
# Next we can add reasons for doubt. In this case we're saying
# that examples deserve another look if the associated proba values
# are low or if the model output doesn't match the associated label.
reasons = {
'proba': ProbaReason(model=model),
'wrong_pred': WrongPredictionReason(model=model)
}
# Pass these reasons to a doubtlab instance.
doubt = DoubtEnsemble(**reasons)
_o_predicates = doubt.get_predicates(X, y)
return _o_predicates
show_doubt_if_modeling()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment