Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Homework 2

Advanced Machine Learning

Spring 2023

Problem 1 (20 points):  Classication

Generate dataset consisting of 4 two-dimensional Gaussians that correspond to 4 different classes. Randomly permute this data set. Design a fully-connected network with at least one hidden layer that solves the resulting classification problem. Implement this network in PyTorch. Take 10% of the data as testing and the rest as training. Use NLL (negative log-likelihood) as your loss function. Show the architecture of your design, plot the train and test loss as a function of the training time (report the loss after each data mini-batch), and report the final training and test accuracy.

Problem 2 (20 points): Regression

Generate a 2-D data set, where data points (tf u) are randomly drawn from a uniform distribution on a plane [-10f 10] × [-10f 10]. Let the data set have 5000 data points. Let f (tf u) = t2 + tu + u2 . Design a fully-connected neural network with at least one hidden layer to predict the value of the function f given (tf u). Implement this network in PyTorch. Take 10% of the data as testing and the rest as training.  Use MSE (mean-squared error) as your loss function.  Show the architecture of your design, plot the train and test loss as a function of the training time (report the loss after each data mini-batch), and report the nal training and test loss.

Problem 3 (30 points):  CNNs

Design and implement in PyTorch a CNN architecture which as input takes two images of digits from MNIST dataset and outputs 1 if both images correspond to the same digit and 0 otherwise. Use only 10% of MNIST training data set as your training data set and only 10% of MNIST test data set as your test data set. The obtained datasets need to be then modified appropriately for this learning task. You network should take as input a 4-dimensional tensor:  (batch size, plane count - each plane corresponds to a different input digit image, image height, image width). Report the architecture and the full evaluation study of the performance of your network.

Problem 4 (30 points): ResNets

Read the paper on ResNets: https://arxiv.org/pdf/1512.03385.pdf to un- derstand what the residual networks are. Train the ResNet model using the code from https://github.com/drgripa1/resnet-cifar10 on CIFAR 10 data set. You will need to train it using different optimization strategies: SGD, momentum SGD with momentum term equal to 0,9, and ADAM. Report train and test error and train and test loss versus iterations.  For each method, play with different learning rates to see which one gives you the best performance (fastest convergence and best nal test error). What do you observe when you compare the methods?