Reputation: 21
Keras gives the error : ValueError: ('Could not interpret activation function identifier:', [, ])
importing the activations:
from keras.activations import relu, elu, linear, sigmoid
Defining grid of parameters:
params = {'lr': [0.001, 0.1],
'first_neuron':[5,9],
'hidden_layers':[1,5,10],
'batch_size': [30,40,50],
'epochs': [40],
'dropout': [0,0.2],
'kernel_initializer': ['normal'],
'optimizer': [Adam],
#'loss':[mean_absolute_error],
'activation':[],
'last_activation':['linear']
}
Calling a model :
regression__model = regression_model(X_air_train, y_air_train, X_air_valid, y_air_valid, params)
Upvotes: 2
Views: 5726
Reputation: 29
Your activation parameter is empty.
To solve this...
from keras.activations import *
Note: the (*) sign allows you to use any of the activation functions in Keras without the need to specify their names.
params = {'lr': [0.001, 0.1],
'first_neuron':[5,9],
'hidden_layers':[1,5,10],
'batch_size': [30,40,50],
'epochs': [40],
'dropout': [0,0.2],
'kernel_initializer': ['normal'],
'optimizer': ['Adam'], ## << notice the added quotation marks
#'loss':[mean_absolute_error],
'activation':['relu', 'elu', 'sigmoid'],
'last_activation':['linear']
}
Upvotes: 1