Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need the whole code. Use of any toolbox or library for neural networks is prohibitied! a : In this project we will consider another
I need the whole code. Use of any toolbox or library for neural networks is prohibitied!
a : In this project we will consider another example of Human Activity Recognition (abbreviated as HAR) problem. The data set contains samples from 6 different human activities: Class 1-6 as walking, walking upstairs, walking downstairs, sitting, standing and laying, respectively. By using a smartphone (Samsung Galaxy S II) and its embedded accelerometer and gyroscope, 3-axial linear acceleration and 3-axial angular velocity signals are captured and recorded at a constant rate of 50Hz. From these signals, by subtracting the effect of gravity a third signal was also generated. The resulting dataset contains 7352 train, 2947 test patterns, each of which containing the recorded signals. These waveforms could be accessed in the dataset under inertial signals subfolders of train and test folders. These time domain signals could be used for time series analysis, as we did in Mini Project 2. As sample of these signals for some class examples are given below. However, in this project we will not use these time domain features. Instead, some statistical features of these signals (such as mean, standard deviation, variance, skewness, kurtosis, etc.) were extracted and given as a 561 dimensional vector per pattern in the dataset. The features used and their explanations are given in features.txt and features-info.txt. The training dataset containing these features and their labels are in X-train.txt and y-train.txt files in train folder, and test dataset containing these features and and their labels are in X-test.txt and y-test.txt files in test folder, respectively. b : For pattern recognition the following 2 hidden layer structure will be used. Hidden layer 1 will contain N1 neurons, hidden layer 2 contains N2 neurons. Use RELU activation function in hidden layers. Output is a softmax layer, each output representing one class. The cost to be minimized is categorical cross entropy. Initialize the weights/biases by using uniform distribution in [0.1,0.1]. The hyperparameters are chosen as : - The learning constant =0.001,0.01. - N1=300,N2=100,200 - Momentum constant =0,0.9 ( =0 case is no momentum case). - The mini batch size as 0,50 . ( 0 batch size means online learning, i.e. apply one pattern and back propagate). - Choose 10% of the training set data as validation set (uniformly distributed on activity classes). For the termination of back propagation, use early stopping in all of your simulations. c : For each of the cases given in b do the following : Run the back propagation algorithm for 100 epochs. Report the following : training error as a function of epochs, accuracy measured over the test set, list of patterns which are misclassified for both training and test set, and discuss your results. d : For the best configuration found in c, repeat the back propagation with dropout rate p=0.5, only for the second hidden layer. (Note that for online learning or minibatch case, for each pattern, random p percent of the neurons are dropped out. Refer to the class notes). Report the same items mentioned above. 1. Prepare a report (including your answers/plots) to be uploaded on Moodle. 2. The report should be typeset (no handwriting allowed except for lengthy derivations, which may be scanned and embedded into the report). 3. Show all steps of your work clearly. 4. Unclear presentation of results will be penalized heavily. 5. No partial credits for unjustified answers. 6. Use of any toolbox or library for neural networks is prohibited. 7. Return all Matlab/Python code that you wrote in a single .m/ . py file. 8. Code should be commented, 9. The code file should NOT return an error during runtime. 10. If the code returns an error at any point, the remaining part of your code will not be evaluated (i.e., 0 points)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started