autointent.metrics.regex.regex_partial_precision#

autointent.metrics.regex.regex_partial_precision(y_true, y_pred)#

Calculate regex partial precision.

The regex partial precision is calculated as:

\[\text{Partial Precision} = \frac{\sum_{i=1}^N \mathbb{1}(y_{\text{true},i} \in y_{\text{pred},i})}{\sum_{i=1}^N \mathbb{1}(|y_{\text{pred},i}| > 0)}\]

where:

  • \(N\) is the total number of samples,

  • \(y_{\text{true},i}\) is the true label for the \(i\)-th sample,

  • \(y_{\text{pred},i}\) is the predicted label for the \(i\)-th sample,

  • \(|y_{\text{pred},i}|\) is the number of predicted labels for the \(i\)-th sample,

  • \(\mathbb{1}(\text{condition})\) is the indicator function that equals 1 if the condition is true and 0 otherwise.

Parameters:
  • y_true (autointent.metrics.custom_types.LABELS_VALUE_TYPE) – True values of labels.

  • y_pred (autointent.metrics.custom_types.LABELS_VALUE_TYPE) – Predicted values of labels.

Returns:

Score of the regex partial precision.

Return type:

float