Question: Can you help me complete this project In this project you will train a Multilayer Perceptron on a small dataset in order to study the
Can you help me complete this project
In this project you will train a Multilayer Perceptron on a small dataset in order to study the effects of sample size and model complexity on variance and bias.
The MLP will be implemented using the PyTorch library.
The data set is a binary classification synthetic dataset generated using makemoonsnsamplesnsamples, noisenoiselevel, randomstate
from the SciKit Learn. nsamples and noise are variables to be set.
Task one: Write the code to do the following:
Generates the dataset and split it into training and validation sets.
Designs an MLP with a single hidden layer and ReLU activation.
The number of hidden units is a variable.
Uses the cross entropy loss function.
Trains the model for epochs and plot the training and validation losses on the same graph vs the epoch number.
Results and Discussion:
Set the noise level to Plot the loss for N number of hidden units for each of the following cases: mathrmntext samples
Set the noise level to and repeat.
Set the noise level to and repeat.
Discussion: Compare and discuss the results in terms of overfitting as a function of
Number of samples
Noise level
Number of neurons in the hidden layer N
Task two: Add ell regularization to your code. Plot the losses of training and validation sets for three choices of weight decay parameter, namely lambda weightdecay mathrmemathrmemathrme for the following cases:
nsamples
noise
N number of hidden units
Discuss your results in terms of N and lambda
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
