Skip to content

Instantly share code, notes, and snippets.

@bkaankuguoglu
Last active April 1, 2021 23:18
Show Gist options
  • Save bkaankuguoglu/88df421aa5b2f0d0e196f8b42866e058 to your computer and use it in GitHub Desktop.
Save bkaankuguoglu/88df421aa5b2f0d0e196f8b42866e058 to your computer and use it in GitHub Desktop.
from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score
def calculate_metrics(df):
return {'mae' : mean_absolute_error(df.value, df.prediction),
'rmse' : mean_squared_error(df.value, df.prediction) ** 0.5,
'r2' : r2_score(df.value, df.prediction)}
result_metrics = calculate_metrics(df_result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment