Metric Functions

Description

This module contains the functions to calculate the metrics accuracy, Cohen’s kappa coefficient, logarithmic loss and root-mean-squared error. These functions are used to evaluate the performance of the given data.

bciflow.modules.analysis.metric_functions.accuracy(results: DataFrame) float[source]

Calculates the accuracy given the correct labels and the predicted probabilities.

Parameters:

results (pandas.DataFrame) – Dataframe with the true label and predicted probabilities.

Returns:

Accuracy value.

Return type:

float

bciflow.modules.analysis.metric_functions.kappa(results: DataFrame) float[source]

Calculates the Cohen’s kappa coefficient given the correct labels and the predicted probabilities.

Parameters:

results (pandas.DataFrame) – Dataframe with the true label and predicted probabilities.

Returns:

Kappa value

Return type:

float

bciflow.modules.analysis.metric_functions.logloss(results: DataFrame) float[source]

Calculates the logarithmic loss given the correct labels and the predicted probabilities.

Parameters:

results (pandas.DataFrame) – Dataframe with the true label and predicted probabilities.

Returns:

Logarithmic loss value.

Return type:

float

bciflow.modules.analysis.metric_functions.rmse(results: DataFrame) float[source]

Calculates the root-mean-squared error given the correct labels and the predicted probabilities.

Parameters:

results (pandas.DataFrame) – Dataframe with the true label and predicted probabilities.

Returns:

Root-mean-squared error value.

Return type:

float