kiwi.metrics.functions

Module Contents

Functions

mean_absolute_error(y, y_hat)

mean_squared_error(y, y_hat)

delta_average(y_true, y_rank) → float

Calculate the DeltaAvg score.

precision(tp, fp, fn)

recall(tp, fp, fn)

fscore(tp, fp, fn)

confusion_matrix(hat_y, y, n_classes=None)

scores_for_class(class_index, cnfm)

precision_recall_fscore_support(hat_y, y, labels=None)

f1_product(hat_y, y)

f1_scores(hat_y, y) → Tuple[Any, np.ndarray]

Compute and return f1 for each class and the f1_product.

matthews_correlation_coefficient(hat_y, y)

Compute Matthews Correlation Coefficient.

kiwi.metrics.functions.mean_absolute_error(y, y_hat)
kiwi.metrics.functions.mean_squared_error(y, y_hat)
kiwi.metrics.functions.delta_average(y_true, y_rank)float

Calculate the DeltaAvg score.

This is a much faster version than the Perl one provided in the WMT QE task 1.

References: could not find any.

Author: Fabio Kepler (contributed to MARMOT).

Parameters
  • y_true – array of reference score (not rank) of each segment.

  • y_rank – array of rank of each segment.

Returns

the absolute delta average score.

kiwi.metrics.functions.precision(tp, fp, fn)
kiwi.metrics.functions.recall(tp, fp, fn)
kiwi.metrics.functions.fscore(tp, fp, fn)
kiwi.metrics.functions.confusion_matrix(hat_y, y, n_classes=None)
kiwi.metrics.functions.scores_for_class(class_index, cnfm)
kiwi.metrics.functions.precision_recall_fscore_support(hat_y, y, labels=None)
kiwi.metrics.functions.f1_product(hat_y, y)
kiwi.metrics.functions.f1_scores(hat_y, y) → Tuple[Any, np.ndarray]

Compute and return f1 for each class and the f1_product.

kiwi.metrics.functions.matthews_correlation_coefficient(hat_y, y)

Compute Matthews Correlation Coefficient.

Parameters
  • hat_y – list of np array of predicted binary labels.

  • y – list of np array of true binary labels.

Returns

the Matthews correlation coefficient of hat_y and y.