Enrollments started for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 5 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
We shall now build the classification network, with a hidden layer(with 30 neurons and selu
activation function) and an output layer( with 1 neuron since we have to predict only one value).
We shall also specify the loss function we have defined - the huber_fn
and the optimizer to use, while compiling.
Note:
kernel_initializer
defines the way to set the initial random weights of Keras layers.Set "selu"
as the activation
and "lecun_normal"
as the kernel_initializer
for the following model.
model = keras.models.Sequential([
keras.layers.Dense(30, activation=<< your code comes here >>,
kernel_initializer=<< your code comes here >>,
input_shape=X_train.shape[1:]),
keras.layers.Dense(1),
])
Compile the model
using compile
.
Set loss
to be huber_fn
which is the custom loss function we defined
We will be using "nadam"
optimizer and "mae"
metric.
model.<< your code comes here >>(loss=<< your code comes here >>, optimizer="nadam", metrics=["mae"])
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...