Skip to content

Instantly share code, notes, and snippets.

@h3ik0th
Created Oct 16, 2021
Embed
What would you like to do?
# summary:
# if you have multiple values with individual names, e.g. a list of metrics which
# you want to summarize, collect the values in a list
rmse = 1
mape = 0.04
rsq = 0.9
acc_values = [rmse, mape, rsq]
# define a list of names for the metrics
acc_names = ["RMSE", "MAPE", "R-sq"]
# combine the lists of names and values via zipping to a dictionary
acc_dict = {k: v for k, v in zip(acc_names, acc_values)}
# pretty-print the dictionary of metrics
_ = [print(k, ":", f'{v:.1f}') for k,v in acc_dict.items()]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment