Skip to content

Instantly share code, notes, and snippets.

@h3ik0th
Created October 16, 2021 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h3ik0th/0a93174678d88f4641a3ce71059e2fcf to your computer and use it in GitHub Desktop.
Save h3ik0th/0a93174678d88f4641a3ce71059e2fcf to your computer and use it in GitHub Desktop.
# 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