Closed kenfus closed 5 years ago
Can you try the upcoming release v.0.6 and see if you get the same error message:
pip install git+https://github.com/autonomio/talos@params-api-test
I fixed it:
callbacks=[EarlyStopping(monitor='val_acc', patience=int(4))]
It has to be written like this! I found it in the Keras-Manual.
Great :) Closing here.
This mainly happens because you forgot to put []
for the list. In my case:
stopping = callbacks.EarlyStopping(monitor='val_loss', patience=20)
history = model.fit_generator(train_generator,
steps_per_epoch=100,
epochs=100,
callbacks=[stopping],
validation_data=test_generator,
validation_steps=100)
Hope it helps.
This mainly happens because you forgot to put
[]
for the list. In my case:stopping = callbacks.EarlyStopping(monitor='val_loss', patience=20) history = model.fit_generator(train_generator, steps_per_epoch=100, epochs=100, callbacks=[stopping], validation_data=test_generator, validation_steps=100)
Hope it helps.
Thank you very much for your answer! It really helps me
Thanks so much for coming here to raise an issue. Please take a moment to 'check' the below boxes:
[x] I'm up-to-date with the latest release:
pip install -U talos
[x] I've confirmed that my Keras model works outside of Talos.
If you still have an error, please submit complete trace and a code with:
You can provide the code in pastebin / gist or any other format you like. This is the whole code. It works when I remove the early_stopping but I'd like to use it!
Thanks so much.
https://towardsdatascience.com/hyperparameter-optimization-with-keras-b82e6364ca53
Function to create model, required for KerasClassifier
def get_model(x_train, y_train, x_val, y_val, params):
create model
p = {'lr': [0.0001], 'neurons':[1200,1500], 'decay':[0], 'optimizer': ["Adam"], 'hidden_layers':[3], 'momentum': [0.0], 'batch_size': [128], 'loss': ["sparse_categorical_crossentropy"], 'epochs': [250], 'dropout': [0.2,0.3]}
t = ta.Scan(x=X_train, y=y_train, params = p, model=get_model)
TypeError Traceback (most recent call last)