Shallow Neural Network with Stochastic Gradient Descent

21 views (last 30 days)
Hi
I am looking to design a shallow neural network with the gradient descent algorithm. From what I can find from research and Googling, the old Neural Networks toolbox didn't have this option. I understand the options I am looking for are available with the CNN functions. But I just need a simple multilayered Aritificial Neural Network with stochastic gradient descent. I have the neural network setup with feedforwardnet but I can't find any function for stochastic gradient descent as a training function, i.e. no mini-Batches.
So far, I have the simple gradient descent: net.trainFcn = 'traingd';
Am I missing something? Or coding it from scratch is the only option?

Accepted Answer

Srivardhan Gadila
Srivardhan Gadila on 26 Mar 2020
The following command lists all the training functions available:
help nntrain
From the output I can see that stochastic gradient descent is not there in case of shallow neural networks.
Since that you want a simple Multilayered ANN, refer to List of Deep Learning Layers & use appropriate layer from Input Layers followed by fullyconnectedLayers & appropriate Output Layer. Then use the 'sgdm' in trainingOptions.
  1 Comment
Maryam Saeed
Maryam Saeed on 26 Mar 2020
Hi Thank you for your answer. I have implemented it as you've mentioned with fully connected layers and it works just great.

Sign in to comment.

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!