OCDocker.OCScore.Utils.Evaluation module¶
Set of functions to manage evaluation operations in OCDocker in the context of scoring functions.
Usage:
import OCDocker.OCScore.Utils.Evaluation as ocseval
- OCDocker.OCScore.Utils.Evaluation.compute_auc(df, positive_class_names, score_columns, class_column_name)[source]¶
Compute the AUC for the scores in given score_columns.
- Parameters:
df (pd.DataFrame) – The DataFrame containing the scores.
positive_class_names (Union[str, list[str]]) – The name/names of the positive class. If a string is given, it will be converted to a list. (All other classes will be considered as negative)
score_columns (list[str]) – The list of columns containing the scores.
class_column_name (str) – The name of the column containing the class.
- Returns:
The DataFrame with the computed AUC.
- Return type:
pd.DataFrame
- OCDocker.OCScore.Utils.Evaluation.compute_metrics(df, score_columns, target_column_name, db_column_name, metric_db_name, class_column_name, positive_class_names, invert_conditionally=True)[source]¶
Compute the metrics for the scores in given score_columns.
- Parameters:
df (pd.DataFrame) – The DataFrame containing the scores.
score_columns (list[str]) – The list of columns containing the scores.
target_column_name (str) – The name of the column containing the target values.
db_column_name (str) – The name of the column containing the database name which will be assigned to RMSE or AUC.
metric_db_name (tuple[str, str]) – The pair of values which will be assigned to RMSE and AUC respectively.
class_column_name (str) – The name of the column containing the class.
positive_class_names (Union[str, list[str]]) – The name/names of the positive class. If a string is given, it will be converted to a list. (All other classes will be considered as negative)
invert_conditionally (bool) –
- Returns:
The DataFrame with the computed metrics.
- Return type:
pd.DataFrame
- Raises:
ValueError – If metric_db_name does not have two elements.
- OCDocker.OCScore.Utils.Evaluation.compute_rmse(df, score_columns, target_column_name)[source]¶
Compute the RMSE for the scores in given score_columns.
- Parameters:
df (pd.DataFrame) – The DataFrame containing the scores.
score_columns (list[str]) – The list of columns containing the scores.
target_column_name (str) – The name of the column containing the target values.
- Returns:
The DataFrame with the computed RMSE.
- Return type:
pd.DataFrame