below just did a lesson about it but need to understand it and would like help on how to implement it. If you need more

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

below just did a lesson about it but need to understand it and would like help on how to implement it. If you need more

Post by answerhappygod »

below just did a lesson about it but need to understand it and
would like help on how to implement it. If you need more
information please ask before you answer this. *** Python
work***
please take in account not to include libraries
of sklearn, pytorch, tensorflow in your
implementation. If you can answer it step by step
will greatly appreciate it and i will understand better for future
what needs to be done on a type of question.
Below Just Did A Lesson About It But Need To Understand It And Would Like Help On How To Implement It If You Need More 1
Below Just Did A Lesson About It But Need To Understand It And Would Like Help On How To Implement It If You Need More 1 (176.08 KiB) Viewed 45 times
Below Just Did A Lesson About It But Need To Understand It And Would Like Help On How To Implement It If You Need More 2
Below Just Did A Lesson About It But Need To Understand It And Would Like Help On How To Implement It If You Need More 2 (143.01 KiB) Viewed 45 times
Below Just Did A Lesson About It But Need To Understand It And Would Like Help On How To Implement It If You Need More 3
Below Just Did A Lesson About It But Need To Understand It And Would Like Help On How To Implement It If You Need More 3 (165.51 KiB) Viewed 45 times
Below Just Did A Lesson About It But Need To Understand It And Would Like Help On How To Implement It If You Need More 4
Below Just Did A Lesson About It But Need To Understand It And Would Like Help On How To Implement It If You Need More 4 (157.56 KiB) Viewed 45 times
Task 3 - Neural Networks In this task, you need to implement a popular machine learning algorithm, Neural Networks. You will train and test a simple neural network with the datasets provided to you and experiment with different settings of hyper parameters. The dataset provided to you is of Zalando's research, and consists of images of fashion items. A sample of the dataset is given below: The training and test datasets are provided to you together with this assignment in the following files: Training examples: fashion-mnist_train.csv.gz Test examples: fashion-mnist_test.csv.gz Data There are 60,000 training examples and 10,000 test examples. Each example is a grayscale image, associated with a label from 10 classes. Each image is 28x28 pixels, i.e consists of 784 pixels in total. Each pixel has a grayscale value represented as an integer between 0 and 255, with O indicates white and 255 indicates black. The training and test data sets have 785 columns. The first column consists of the class labels (see below), and represents the article of clothing. The rest of the 784 columns contain the pixel-values of the associated image. Labels Each training and testing example is assigned to one of the following labels: O T-shirt/top 1 Trouser 2 Pullover 3 Dress 4 Coat 5 Sandal 6 Shirt 7 Sneaker 8 Bag 9 Ankle boot

An example of some samples with there classes can be seen below: Class: Pullover Class: Trouser Class: Shirt le 10 20 Class Sneaker 10 20 Class: Bag Class: Dress Implementation requirements Your task is to implement a neural network learning algorithm that creates a neural network classifier based on the given training dataset. Your network has 3 layers: an input layer, one hidden layer and an output layer. You should name your main file as nn.py which accepts five arguments. Your code should be run on the command line in the following manner: > python nn.py NInput NHidden NOutput fashion-mnist_train.csv.gz fashion- mnist_test.csv.gz Where the meaning of each argument is: NInput: number of neurons in the input layer NHidden: number of neurons in the hidden layer NOutput: number of neurons in the output layer fashion-mnist_train.csv.gz: the training set fashion-mnist_test.csv.gz: the test set Note: you can use numpy.loadtxt() and numpy.savetxt() methods to read from or write to a csv.gz. There is no need to un-compress the file before use. To making plots, you can use the Python library matplotlib. The nonlinearity used in your neural net should be the basic sigmoid function: (x) = 1 1 + e-*

The main steps of training a neural net using stochastic gradient descent are: 1. Assign random initial weights and biases to the neurons. Each initial weight or bias is a random floating-point number drawn from the standard normal distribution (mean 0 and variance 1). 2. For each training example in a mini-batch, use backpropagation to calculate a gradient estimate, which consists of following steps: a. Feed forward the input to get the activations of the output layer. b. Calculate derivatives of the cost function for that input with respect to the activations of the output layer. C. Calculate the errors for all the weights and biases of the neurons using backpropagation. 3. Update weights (and biases) using stochastic gradient descent: m n W → W- m i=) Σerror where m is the number of training examples in a mini-batch, error is the error of weight w for input i, and n is the learning rate. 4. Repeat this for all mini-batches. Repeat the whole process for specified number of epochs. At the end of each epoch evaluate the network on the test data and display its accuracy. For this part of the assignment, use the quadratic cost function: 1 C(w, b) = Ž 115(x;) – y: 112 2n where w: weights b: biases n: number of test instances xi: ith test instance vector yi: ith test label vector, i.e. if the label for x; is 8, then y; will be (0,0,0,0,0,0,0,0,1,0) (see below) f(x): Label predicted by the neural network for an input x For this fashion images recognition assignment, we will encode the output (a number between 0 and 9) by using 10 output neurons. The neuron with the highest activation will be taken as the prediction of the network. So the output number y has to be represented as a vector of 10 binary digits, all of them being O except for the entry at the correct digit.

1. Create a neural network of size (784, 30, 10). This network has three layers: 784 neurons in the input layer, 30 neurons in the hidden layer, and 10 neurons in the output layer. Then train it on the training data with the following settings: epoch = 30, minibatch size = 20, n = 3. Test your code on the test data and make plots of test accuracy vs epoch. Report the maximum accuracy achieved. 2. Train new neural networks with the same settings as in (1.) above but with different learning rates n = 0.001, 0.1, 1.0, 10, 100. Plot test accuracy vs epoch for each n on the same graph. Report the maximum test accuracy achieved for each n. Remember to create a new neural net each time so its starts learning from scratch. 3. Train new neural nets with the same settings as in (1.) above but with different mini-batch sizes = 1, 5, 10, 20, 100. Plot maximum test accuracy vs mini-batch size. Which one achieves the maximum test accuracy? Which one is the slowest? 4. Try different hyper-parameter settings (number of epochs, n, and mini-batch size, etc.). Report the maximum test accuracy you achieved and the settings of all the hyper parameters. 5. An alternate cost function: Now replace the quadratic cost function by a cross entropy cost function: 1 C(w,b) =- 3 yiln[/(x)] +(1 – y;)]n[1 –S(38;)] i=1 Train a neural network as before and try different hyper-parameter settings. What is the test maximum accuracy achieved? Report requirements Your report should include: a. Software design: information about each function and data structure. b. All experimental results and graphs mentioned above, and detailed explanations of these results. i.e. try to explain the logic behind the results you achieved. C. Conclusions.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply