Registrations Closing Soon for DevOps Certification Training by CloudxLab | Registrations Closing inEnroll Now
Let us define the model for the classification of data set A that we have created previously.
Later the trained weights of this model will be used for the classification task of data B.
Create a keras neural network as follows:
keras.layers.Flatten to flatten the input image to the model.
Add 5 dense layers with
n_hidden number of neurons and
selu activation function.
Add a final dense layer with 8 neurons and
softmax activation function(for classifying 8 classes of data).
model_A = keras.models.Sequential() model_A.add(keras.layers.Flatten(input_shape=[28, 28])) for n_hidden in (300, 100, 50, 50, 50): model_A.add(keras.layers.Dense(n_hidden, activation="selu")) model_A.add(keras.layers.Dense(8, activation="softmax"))
Define the compiling part of the model:
"sparse_categorical_crossentropy" as loss.
keras.optimizers.SGD(lr=1e-3) as optimizer.
model_A.compile(loss= << your code comes here >>, optimizer= << your code comes here >>, metrics=["accuracy"])
y_train_A for 5 epochs , and
validation_data=(X_valid_A, y_valid_A) using
history = << your code comes here >>(X_train_A, y_train_A, epochs=5, validation_data=(X_valid_A, y_valid_A))
model_A we created.
No hints are availble for this assesment
Answer is not availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here