Package: tuneconfig
tuneconfigHyperparameter config file generator and experiment runner.Quickstart$pipinstall-UtuneconfigUsageConfig file generatorimportpprintimporttuneconfig# Define parameter formatting functiondefformat_fn(param):fmt={"batch_size":"batch","horizon":"hr","learning_rate":"lr","optimizer":"opt","epochs":None,"num_samples":None,}returnfmt.get(param,param)# Define a configuration template for grid searchconfig_iterator=tuneconfig.ConfigFactory({"batch_size":tuneconfig.grid_search([32,128]),"horizon":40,"learning_rate":tuneconfig.grid_search([0.01,0.1]),"epochs":1000,"optimizer":tuneconfig.grid_search(["Adam","RMSProp"]),"num_samples":10},format_fn=format_fn)# Iterate over config dictsforidx,configinenumerate(config_iterator):name=config_iterator._trial_id(config)print(f"config{idx}({name}):")pprint.pprint(config)print()# Dump config dicts as JSON filestmp="/tmp/tuneconfig"json_config_files=config_iterator.dump(tmp)print(">> Saved config files:")pprint.pprint(json_config_files)config0(batch=32/hr=40/lr=0.01/opt=Adam):{'batch_size':32,'epochs':1000,'horizon':40,'learning_rate':0.01,'num_samples':10,'optimizer':'Adam'}config1(batch=32/hr=40/lr=0.01/opt=RMSProp):{'batch_size':32,'epochs':1000,'horizon':40,'learning_rate':0.01,'num_samples':10,'optimizer':'RMSProp'}config2(batch=32/hr=40/lr=0.1/opt=Adam):{'batch_size':32,'epochs':1000,'horizon':40,'learning_rate':0.1,'num_samples':10,'optimizer':'Adam'}config3(batch=32/hr=40/lr=0.1/opt=RMSProp):{'batch_size':32,'epochs':1000,'horizon':40,'learning_rate':0.1,'num_samples':10,'optimizer':'RMSProp'}config4(batch=128/hr=40/lr=0.01/opt=Adam):{'batch_size':128,'epochs':1000,'horizon':40,'learning_rate':0.01,'num_samples':10,'optimizer':'Adam'}config5(batch=128/hr=40/lr=0.01/opt=RMSProp):{'batch_size':128,'epochs':1000,'horizon':40,'learning_rate':0.01,'num_samples':10,'optimizer':'RMSProp'}config6(batch=128/hr=40/lr=0.1/opt=Adam):{'batch_size':128,'epochs':1000,'horizon':40,'learning_rate':0.1,'num_samples':10,'optimizer':'Adam'}config7(batch=128/hr=40/lr=0.1/opt=RMSProp):{'batch_size':128,'epochs':1000,'horizon':40,'learning_rate':0.1,'num_samples':10,'optimizer':'RMSProp'}>>Savedconfigfiles:['/tmp/tuneconfig/batch=32/hr=40/lr=0.01/opt=Adam/config.json','/tmp/tuneconfig/batch=32/hr=40/lr=0.01/opt=RMSProp/config.json','/tmp/tuneconfig/batch=32/hr=40/lr=0.1/opt=Adam/config.json','/tmp/tuneconfig/batch=32/hr=40/lr=0.1/opt=RMSProp/config.json','/tmp/tuneconfig/batch=128/hr=40/lr=0.01/opt=Adam/config.json','/tmp/tuneconfig/batch=128/hr=40/lr=0.01/opt=RMSProp/config.json','/tmp/tuneconfig/batch=128/hr=40/lr=0.1/opt=Adam/config.json','/tmp/tuneconfig/batch=128/hr=40/lr=0.1/opt=RMSProp/config.json']LicenseCopyright (c) 2020 Thiago Pereira Bueno All Rights Reserved.tuneconfig is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.tuneconfig is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details.You should have received a copy of the GNU Lesser General Public License
along with tuneconfig. If not, seehttp://www.gnu.org/licenses/.