INNER CODE UNIT · Python
_score_evaluation_data_performance
dragondrop-cloud/cloud-concierge · nlpengine/main.py:257
def _score_evaluation_data_performance(
actual_list_of_dicts: List[dict],
prediction_list_of_dicts: List[dict],
) -> dict:
"""
Helper function to score prediction performance on evaluation data.
"""
actual_score_df = pd.DataFrame(actual_list_of_dicts)
predicted_score_df = pd.DataFrame(prediction_list_of_dicts)
predicted_score_df["max_score"] = predicted_score_df.max(axis=1)
for column in predicted_score_df.columns[:-1]:
predicted_score_df[column] = (
predicted_score_df[column] == predicted_score_df["max_score"]
).astype(float)