Classification with Fully Connected Neural Networks
MNIST classification with a fully connected model with pytorch.
In this task, you should train a fully-connected model with pytorch to classify MNIST dataset.
Load the MNIST dataset bellow. You can use either torchvision.datasets.MNIST
or sklearn.datasets.fetch_openml()
or any other way to load the dataset.
Write your fully-connected model below using torch.nn
modules. Feel free to add extra cells.
Write the training process below. Instantiate your model, Create an optimizer function such as Adam or SGD, and write your train/validation loop. Then train your model until it converges. Feel free to add extra cells.
Draw two diagrams for train and validation, one showing loss of each epoch, and another showing accuracy of each epoch.
Evaluate the best epoch's model (according to the validation accuracy) on the test set, and report the accuracy. Is your model overfitted?
Draw 20 misclassified images from test set with expected and predicted labels.
Plot the confusion matrix for the test set.