def objective(params): optimize_model = build_lstm_v1.lstm_multi_104( params, train_data2.shape[2], H_t2.shape[2], (std_inv / std_inv2)) #Check code here, relu entering loss_out = NNFunctions.model_optimizer_101(optimize_model, train_data2, H_t2, val_data2, H_val2, 5) return {'loss': loss_out, 'status': STATUS_OK}
(std_inv / std_inv2)) #Check code here, relu entering loss_out = NNFunctions.model_optimizer_101(optimize_model, train_data2, H_t2, val_data2, H_val2, 5) return {'loss': loss_out, 'status': STATUS_OK} trials = Trials() best2 = fmin(objective, space2, algo=tpe.suggest, trials=trials, max_evals=20) #Building Stateful Model lstm_hidden = hyperopt.space_eval(space2, best2) print lstm_hidden tsteps2 = std_inv / std_inv2 #Building model lstm_model = build_lstm_v1.lstm_multi_104(lstm_hidden, train_data2.shape[2], H_t2.shape[2], tsteps2) save_model = lstm_model ##callbacks for Early Stopping callbacks = [EarlyStopping(monitor='val_loss', patience=5)] #parameters for simulation attempt_max = 3 epoch_max = 50 min_epoch = 10 #Criterion for early stopping tau = 5 e_mat = numpy.zeros((epoch_max, attempt_max)) e_temp = numpy.zeros((tau, ))