MAT3300 Assignment 6

Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due

Exercise 1. Build, train, and evaluate a Neural Network to classify handwritten digits (0–9) from the MNIST dataset using PyTorch.

(0) Environment Setup. Ensure PyTorch is installed and running in your local Python envi-ronment, or you may use Google Colab. If you decided to opt for the latter, remember to save your progress from time to time.

(1) Data Preparation. Load the MNIST dataset using torchvision.datasets.MNIST(). Split the dataset into training and test sets. Create DataLoader objects for batch processing.

(2) Model Design. Design and build a Neural Network.

(3) Training the Model. Define a loss function and choose an optimizer. Train the model over multiple epochs and keep track of the loss.

(4) Evaluation. Evaluate the model on the test set. Try to achieve an accuracy level of at least 95%.

(5) Visualization. Plot the training loss over epochs. Display at least four test images alongside their predicted and true labels.

(6) Free Experiments (Optional). Experiment with di!erent models or hyperparameters (e.g., learning rate, batch size, or number of hidden units) and indicate how they a!ect the results.


发表评论

电子邮件地址不会被公开。 必填项已用*标注