Reasoning Inspector & Audit¶
- jlnn.reasoning.inspector.get_rule_report(model: Any, inputs: Dict[str, Array]) str[source]¶
Generates a human-readable semantic interpretation of the model’s output.
This utility classifies the resulting truth interval $[L, U]$ into qualitative categories based on LNN semantics (TRUE, FALSE, UNKNOWN, CONFLICT). It includes specific heuristics for neural predicates that may shift truth values toward the center of the $[0, 1]$ spectrum during initialization or training.
- Parameters:
model – The JLNN model or LNNFormula to evaluate.
inputs – Input data dictionary for the predicates.
- Returns:
A formatted string containing the numerical interval and its semantic classification (e.g., “Result: [0.52, 0.73] - FALSE (NEURAL)”).
- jlnn.reasoning.inspector.trace_reasoning(node: Node, inputs: Dict[str, Array]) List[Dict[str, Any]][source]¶
Recursively audits the logical graph to capture activations for every node.
This function performs a deep introspection of the forward pass by traversing the compiled logical tree. For each node, it captures the resulting truth interval $[L, U]$, which is essential for Explainable AI (XAI) tasks, rule auditing, and debugging model conclusions.
- Parameters:
node – The root node or subtree of a compiled JLNN model.
inputs – A dictionary mapping predicate names to input tensors of shape (batch, [time], features).
- Returns:
‘name’: The descriptive identifier of the node.
’interval’: The average truth interval (L, U) across the batch.
’output’: The raw JAX array containing full activation data.
- Return type:
A list of dictionaries, where each entry represents a node’s state
Module for inspecting and auditing the model. Allows users to look “under the hood” and understand why the model reached a particular conclusion.
Functions for Explainability:¶
Trace Reasoning: Recursively traverses the graph and captures activations (intervals) at each node. This is crucial for identifying logical conflicts.
Human-Readable Reports: Funkce
get_rule_reportpřevádí číselné intervaly na přirozený jazyk (např. “True”, “Unknown”, “Conflict”).