Skip to content

Instantly share code, notes, and snippets.

@prrao87
Created September 2, 2019 01:08
Show Gist options
  • Select an option

  • Save prrao87/773fab7dc5f76cf3aece01d316867cf0 to your computer and use it in GitHub Desktop.

Select an option

Save prrao87/773fab7dc5f76cf3aece01d316867cf0 to your computer and use it in GitHub Desktop.
class ExampleExplainer:
"""Class to explain classification results.
The `predict` method outputs a numpy array of floats, which
is the classifier's prediction probability for each class.
"""
def __init__(self, path_to_model: str) -> None:
# Load in a trained classifier model
def predict(self, texts: List[str]) -> np.array([float, ...]):
# Take in a list of strings (LIME text sample of variations)
...
# Output class probabilities as a numpy array
return np.array(predict_proba)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment