INNER CODE UNIT · Python

acc_and_f1

hooshvare/parsbert · scripts/utils.py:148

def acc_and_f1(predictions, labels):
    acc = simple_accuracy(predictions, labels)
    f1 = f1_score(y_true=labels, y_pred=predictions, average='weighted')
    return {
        "acc": acc,
        "f1": f1,
        "acc_and_f1": (acc + f1) / 2,
    }


def mse_and_mae_and_r2(predictions, labels):
    return {
        "mse": mean_squared_error(labels, predictions),
        "mae": mean_absolute_error(labels, predictions),
        "r2": r2_score(labels, predictions),
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…