Skip to content

Instantly share code, notes, and snippets.

@Lakshmi-1212
Created February 21, 2021 11:32
Show Gist options
  • Save Lakshmi-1212/b940f2022751744319818d28a033992a to your computer and use it in GitHub Desktop.
Save Lakshmi-1212/b940f2022751744319818d28a033992a to your computer and use it in GitHub Desktop.
# Explanation from LIME model for observation 1
observation = 1
# Set the predict function for the model
predict_fn = lambda x: rfmodel.predict_proba(x).astype(float)
# Explain the prediction
lime_explanation = rfexplainer.explain_instance(X_test.values[observation], rfpredict_fn, num_features=10)
# Show the explanation in the notebook
lime_explanation.show_in_notebook(show_table=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment