HpBandSter
HpBandSter copied to clipboard
fixed a bug in get_pandas_dataframe() and added get_sorted_runs_dataframe()
It looks like there is a lot of changes in the pull request but most of them are just deleting blanks (somehow my editor automatically did it for me).
The actual changes happen at line 524 and line 509.
At line 524, .copy()
is added to ensure that each config
is unique and will not be modified in the loop later.
This is necessary because a config_id
can be shared by multiple runs, if a hyperparameter value combination survives all the way from the lowest to the highest budget. We need to do the copy to avoid modifying configs that have the same id but using different budgets.
Currently, a part of the content in all_configs
can look like this
{'hyperparameter': 1.8673196127170794e-05, 'budget': 243.0},
{'hyperparameter': 1.8673196127170794e-05, 'budget': 243.0},
{'hyperparameter': 1.8673196127170794e-05, 'budget': 243.0},
{'hyperparameter': 1.8673196127170794e-05, 'budget': 243.0}]
but instead, it should be
{'hyperparameter': 1.8673196127170794e-05, 'budget': 9.0},
{'hyperparameter': 1.8673196127170794e-05, 'budget': 27.0},
{'hyperparameter': 1.8673196127170794e-05, 'budget': 81.0},
{'hyperparameter': 1.8673196127170794e-05, 'budget': 243.0}]
At line 524, I added the function:
def get_sorted_runs_dataframe(self):
'''
Turns the results of self.get_all_runs() to dataframe to make it more user-friendly.
The dataframe is sorted by loss and budgets (epochs) to make the hyper-parameter value combination with the
smallest loss and budget appear on the top.
Output:
A dataframe where the rows are runs. The first few columns are run_id, budget, and loss. The rest of the columns
are hyperparameters, each with a column.
'''
Let me know if these are valid changes.