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:

Partial Precision=i=1N1(ytrue,iypred,i)i=1N1(|ypred,i|>0)

where:

  • N is the total number of samples,

  • ytrue,i is the true label for the i-th sample,

  • ypred,i is the predicted label for the i-th sample,

  • |ypred,i| is the number of predicted labels for the i-th sample,

  • 1(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