Closed Naghipourfar closed 4 years ago
@Naghipourfar I'm not entirely sure what you're trying to do here, but why can't you flatten this?
def data():
data_name = # some data name
train_data = pd.read_csv(f"./data/{data_name}/train_{data_name}.csv").values
valid_data = pd.read_csv(f"./data/{data_name}/valid_{data_name}.csv").values
return train_data, valid_data
def model(train_data, valid_data):
# some keras model
best_run, best_model = optim.minimize(model=model,
data=data,
algo=tpe.suggest,
max_evals=50,
trials=Trials())
I don't quite see why it makes much of a difference between changing your data_name
in optim.minimize
or in the data
function. You have to modify it in one place regardless.
p.s. I do understand why you want this behavior, but hyperas' design has some limitations. If it's just about functionality, use my snippet above.
@maxpumperla actually, I had no choice so I wrote something like your snippet. Thanks for your help.
Dear @maxpumperla,
Hyperas can't actually support inner functions in python and it's frustrating because when you want to write code for a single model in order to hyperopt for multiple datasets. It is impossible. I will be very grateful if this feature can add to hyperas or if it already exists, you help me how to use it.
Thanks, Mohsen Please see the following code: