Closed PurenBITeam closed 4 years ago
Welcome to Talos community! Thanks so much for creating your first issue :)
Great to hear you find Talos useful :)
You have to add those metrics into your input model before you can use it for reduction. So if you do model.compile(...metrcs=['mae']...)
into your input model, then you can use it in reduction.
This eas the case in my code...see below:
p = {'optimizer': [Adam, Adamax, Nadam, Adagrad, Adadelta], 'first_neuron': [5120, 1024, 512, 128, 64, 32, 16], 'batch_size': [100, 1000, 5000, 10000], 'epochs': [25], 'hidden_layers':[0, 1, 2, 3, 4], 'kernel_initializer': ['uniform', 'normal', 'glorot_uniform'], 'dropout': [0.0, 0.25, 0.5, 0.65, 2, 3, 4, 5, 10], 'losses': ["mape", "mse"], 'shapes': ['brick', 'triangle', 'funnel'], 'activation': ['relu'], 'lr': [0.0001, 0.0002, 0.0005, 0.0009, 0.001, 0.002, 0.005, 0.009, 0.01, 0.02, 0.035, 0.05, 0.075, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9] }
def fcmodel(X_train, y_train, x_val, y_val, params):
model = Sequential()
esr = 3
callbacks = [EarlyStopping(monitor="val_mean_absolute_error", patience=esr, min_delta=0.0001, mode="min",
baseline=0.1)]
model.add(Dense(params['first_neuron'], input_dim=X_train.shape[1],
activation="relu",
kernel_initializer = params['kernel_initializer'] ))
model.add(Dropout(params['dropout']))
## hidden layers
hidden_layers(model, params, 1)
model.add(Dense(1, activation="sigmoid",
kernel_initializer=params['kernel_initializer']))
model.compile(loss=params["losses"],
optimizer=params['optimizer'](lr_normalizer(params['lr'], params['optimizer'])),
metrics=['mae'])
out = model.fit(X_train, y_train,
validation_data=[x_val, y_val],
batch_size=params['batch_size'],
epochs=params['epochs'],
callbacks=callbacks,
verbose=2)
return out, model
t = talos.Scan(x=X_df_train2.values, y=y_df_train2.values, model=fcmodel, params=p, x_val=X_df_val.values, y_val=y_df_val.values, seed=baseseed, experiment_name="TalosPipeline2_Corr", print_params=True, round_limit=250, reduction_method="correlation", reduction_interval=1, reduction_window=1, reduction_threshold=0.2, reduction_metric='mae', minimize_loss=True)
I still get the error message below:
KeyError Traceback (most recent call last)
It might be that your results will not have 'mae' because that's a shorthand in Keras, but it will be 'mean_average_error' instead.
As part of the troubleshoot, you can also try removing all the reduction related arguments from Scan()
:
reduction_method="correlation",
reduction_interval=1,
reduction_window=1,
reduction_threshold=0.2,
reduction_metric='mae'
Thanks...It's working now.
Hello, great package, works very well and helps a lot.
I only got stuck with one issue. Whenever I want to try another reduction technique (e.g. correlation or trees...) and define the reduction metric as "mae" or "mse" or "rmse", I get the message above.
What does this exactly mean?
thanks and br
christoph