#NoPayJan Offer - Access all CloudxLab Courses for free between 1st to 31st JanEnroll Now >>
Let us see how well our model has learned from the train data, by testing it on the test data.
model.evaluate(X_test, y_test) : Returns a list with the loss(at index 0) and accuracy(at index 1) of the predictions of the
array[a:b] : Returns the elements of
array from index
model.predict : Generates output predictions for the input samples. It returns the probabilities of each class for a given test sample. We consider the classification to be of that class(or of that index) whose probability of the highest.
np.argmax : Returns the indices of the maximum values along an axis. More here.
>> a = array([[10, 11, 12], [13, 14, 15]]) >> np.argmax(a) 5 >> np.argmax(a, axis=0) array([1, 1, 1]) >> np.argmax(a, axis=1) array([2, 2])
X_test, y_test to see the test data prediction accuracy:
results = << your code comes here >>(X_test, y_test)
Print the accuracy on the test data.
Let us see the predictions of 9 of the test samples from index 10.
X_test to get 9 of the data samples of the test data from index 10.
X_new = << your code comes here >>
X_new and get the predictions in
y_pred = << your code comes here >>(X_new)
y_pred along the axis=1 and print the classes predicted by the model on
print(<< your code comes here >>(y_pred, axis=1))
Let us also look at the original classes of
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