BasicNeuralNetwork TrainingAndEvaluation - Ipynb Colaboratory
BasicNeuralNetwork TrainingAndEvaluation - Ipynb Colaboratory
ipynb - Colaboratory
airplane
automobile
bird
cat
deer
dog
frog
horse
ship
truck
Create three neural network models and train each for the classsification task above, where each of
the models described should be a different Python class with the specified name.
NetA
The first neural network will be the simplest, in that it has no hidden layers. It should take the image
and flatten it to a vector for the input, and then have 10 outputs, one for each class.
There should be no non-linearities for this network and is just a very simple linear classifier.
NetB
The second neural network will be slightly more complicated in that it has a hidden layer with 300
nodes and adds a non-linearity between the layers. It should use the following operations in this
order:
https://colab.research.google.com/drive/1qD8Z6RXVzch4eTWoru19_AtvtrPsZc4A#scrollTo=JJORzpttqKNl&printMode=true 1/3
7/30/2021 BasicNeuralNetwork-TrainingAndEvaluation.ipynb - Colaboratory
NetC
This third neural network will be a convolutional neural network. It should use the following
operations in this order:
Deliverables:
You need to submit a google collab notebook which
1. imports all the important modules for the specific machine learning library you choose,
2. loads the training and test dataset,
3. trains the given network on the training data for 50 epochs, evaluates the train and test
accuracy of the network at the end of each epoch and creates a visualization of the
training/test accuracy as the training progresses.
4. do this for the three neural network models (NetA, NetB, NetC) described above.
The last cell should print the training and test accuracy of each of the three models, including a
visualization of the accuracy histories for each model during the training. An example of the last
cell is given below for reference only, which can be different from your submission as long as the
required outputs are printed.
nets = [NetA(), NetB(), NetC(), NetD()]
histories = []
for net in nets:
net_name = type(net).__name__
print(f'==== Training {net_name} ====')
train_history, test_history = train(net, train_loader, test_loader,
num_epochs=NUM_EPOCHS,
learning_rate=LEARNING_RATE,
compute_accs=True)
histories.append({
'name': net_name,
'net': net,
'train_accs': train_history,
'test_accs': test_history
})
plot_history(histories)
https://colab.research.google.com/drive/1qD8Z6RXVzch4eTWoru19_AtvtrPsZc4A#scrollTo=JJORzpttqKNl&printMode=true 2/3