Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Train the model on the training data with batch _ size = 1 2 8 and epochs = 2 then return the trained model along

Train the model on the training data with batch_size=128 and epochs=2 then return the trained model along with the training accuracy .
HINT 1: To calculate the training accuracy use evaluate function with trainning data.
HINT 2: Train the model with validation_data=(testing_data) # Function 2: Train the model
def train_model(model, x_train, y_train, x_test, y_test):
'''
input:
model: a compiled CNN model with input of size (28,28,1) and output of size 10
x_train: an array of training dataset
y_train: an array of the labels for the inputs in array x_train
x_test: an array of validation dataset. This validation dataset is used during the training of the model
y_test: an array of the labels for the validation dataset in x_test
output:
t_model: a trained verision of the input model that is trained using the given train dataset
train_accuracy: the accuracy of the model with respect to the training dataset (i.e. use the training dataset to evaluate the model and return the accuracy of the model) as a percentage (i.e. between 0 to 100)
'''
### BEGIN SOLUTION
return t_model, train_accuracy # Return trained model and training accuracy as percentage

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

Do you agree that unions stifle creativity? Why or why not?

Answered: 1 week ago

Question

Which team solution is more likely to be pursued and why?

Answered: 1 week ago