Created
October 16, 2021 11:26
-
-
Save h3ik0th/0a93174678d88f4641a3ce71059e2fcf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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