MLBazaar/MLBlocks

Support flat hyperparameter dictionaries

Closed this issue · 0 comments

csala commented

MLBlocks hyperparameter specification format consists of a hierarchical tree of dictionaries where each key is a block name and each value is a dictionary with the complete hyperparameter specification for that block.

BTB, instead, specifies the hyperparameters as a flat dictionary where the keys are two element tuples containing the name of the block in the first place and the name of the hyperparameter in the second place, and where the values are the corresponding hyperparameter values.

We should add support for that format in the following ways:

  • The internal and main format will continue to be the hierarchical one.
  • MLPipeline.set_hyperparameters will accept both flat and hierarchical formats as input. If a flat dictionary is passed, it will be converted to a hierarchical one.
  • MLPipeline.get_hyperparameters will accept a new argument, flat=False. If set to True, a flat dictionary will be returned. Otherwise (default), the hierarchical one will be returned.
  • MLPipeline.get_tunable_hyperparameters will accept a new argument, flat=False. If set to True, a flat dictionary will be returned. Otherwise (default), the hierarchical one will be returned.