maxpumperla / hyperas

Keras + Hyperopt: A very simple wrapper for convenient hyperparameter optimization
http://maxpumperla.com/hyperas/
MIT License
2.18k stars 318 forks source link

How to optimize a set of hyperparameters for several different datasets #222

Open renan-ms opened 5 years ago

renan-ms commented 5 years ago

I have several different datasets (csv files) and I'd like to perform optimization of the same LSTM model by calling optim.minimize() inside a loop for each and every one of the datasets. Is it possible to do this using the same data() function and choose a new dataset in each of the iterations? I could use different data() functions for every dataset and pass them as parameter to optim.minimize() function accordingly, although it doesn't seem the best way to do such a task. Another option would pass arguments to data() through optim.minimize() but it seems this is not possible. Any suggestions?

Thanks in advance.

def data: if dataset == 1:

load dataset 1

elif dataset == 2:
    #load dataset 2
else:
    #load dataset 3

#process data

return Xtrain, Ytrain, Xtest, Ytest

if name == "main": for dataset in range(1, 3): #iterations best_run, best_model = optim.minimize(model=create_model, data=data, algo=tpe.suggest, max_evals=10, trials=Trials(), arguments = [dataset])