Registrations Closing Soon for DevOps Certification Training by CloudxLab | Registrations Closing inEnroll Now
Let us train the model on the train data.
plt.gca()is used to get a reference to the current axes, if you need to change the limits on the y-axis, for example.
model.fit to train the model. We shall pass the
X_train, y_train, epochs=30, validation_data=(X_valid, y_valid) as input parameters to the method.
history = model.fit(X_train, y_train, epochs=30, validation_data=(X_valid, y_valid))
This might take some time, so go and have a sip of water if you like.
Let us now print the parameter history of the
Let us print the name of the first hidden layer:
hidden1 = model.layers print(hidden1.name)
Let us use
get_weights() function to see the trained
biases of the
weights, biases = hidden1.get_weights() # getting the weights and biases print(weights.shape, weights) print(biases)
Let us visualize the model training history. Here,
history.history is a dictionary containing information about the accuracy and loss measures through the epochs.
Let us store this dictionary as a pandas dataframe and plot the values.
import pandas as pd pd.DataFrame(history.history).plot(figsize=(8, 5)) plt.grid(True) plt.gca().set_ylim(0, 1) # setting limits for y-axis plt.show()
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