Get logic explanations from the neural model¶
- torch_explain.logic.nn.explain_class()¶
Generate a local explanation for a single sample.
- Parameters
model – pytorch model
x – input samples to extract logic formulas.
y1h – target labels to extract logic formulas (MUST be one-hot encoded).
x_val – input samples to validate logic formulas.
y_val1h – target labels to validate logic formulas (MUST be one-hot encoded).
target_class – target class.
max_minterm_complexity – maximum number of concepts per logic formula (per sample).
topk_explanations – number of local explanations to be combined.
max_accuracy – if True a formula is simplified only if the simplified formula gets 100% accuracy.
concept_names – list containing the names of the input concepts.
- Returns
Local explanation