hc: Gnostic Characteristics (Hc) Metric
The hc
function computes the Gnostic Characteristics (Hc) metric, a robust measure for evaluating the relevance or irrelevance between true and predicted values. Here, c
denotes case of i
- Estimation or j
- Quantification condition. This metric is part of the Machine Gnostics framework and is particularly useful for assessing model performance in the presence of noise or outliers.
Overview
The Hc metric quantifies the relationship between predicted and true values using gnostic algebra. It can be used in two modes:
- Relevance (
case='i'
): Measures how relevant the predictions are to the true values as per mathematical gnostics. - Irrelevance (
case='j'
): Measures how irrelevant the predictions are to the true values as per mathematical gnostics.
The metric is calculated as the normalized sum of squared gnostic characteristics, providing a robust alternative to classical error metrics.
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
y_true |
array-like | — | True (ground truth) values. |
y_pred |
array-like | — | Predicted values from the model. |
case |
str | 'i' | Calculation mode:'i' for relevance, 'j' for irrelevance. |
Returns
- float The calculated Hc value (normalized sum of squared gnostic characteristics).
Raises
- ValueError
- If
y_true
andy_pred
have different lengths. - If
case
is not'i'
or'j'
.
Example Usage
from machinegnostics.metrics import hc
y_true = [1, 2, 3]
y_pred = [1, 2, 3]
# Calculate gnostic relevance
hc_value = hc(y_true, y_pred, case='i')
print(hc_value)
Notes
- The function uses the
GnosticsCharacteristics
class from the Machine Gnostics library. - The ratio \(R = y_{\text{true}} / y_{\text{pred}}\) is used to compute the gnostic characteristics.
- The result is normalized by the number of samples.
- Use
case='i'
for relevance andcase='j'
for irrelevance, depending on your analysis needs.