Logical Metrics¶
Logical health and performance metrics for LNN models.
- jlnn.utils.metrics.contradiction_degree(interval: Array) Array[source]¶
Calculates the degree of logical contradiction within a truth interval.
In LNN, a contradiction occurs when the lower bound (L) exceeds the upper bound (U), meaning the evidence for truth is greater than the evidence for possibility.
- Parameters:
interval (jnp.ndarray) – Truth interval tensor [L, U].
- Returns:
Magnitude of contradiction (max(0, L - U)).
- Return type:
jnp.ndarray
- jlnn.utils.metrics.uncertainty_width(interval: Array) Array[source]¶
Calculates the width of the uncertainty gap (U - L).
A width of 0.0 represents a precise truth value (classical logic), while 1.0 represents complete ignorance (unknown).
- Parameters:
interval (jnp.ndarray) – Truth interval tensor [L, U].
- Returns:
The distance between upper and lower bounds.
- Return type:
jnp.ndarray
This module defines metrics for quantifying the quality of logical reasoning.
Contradiction Degree: Measures the extent of violation of the axiom \(L \le U\). A value of 0 indicates a consistent model.
Uncertainty Width: Measures the degree of “ignorance” in the model. The wider the interval \(U - L\), the less information the model has about a given fact.