To train a DL network in MATLAB, the most basic steps are:
deepNetworkDesigner
app or by coding it in MATLABtrainNetwork
functionclassify
or predict
functions.Here's a sample code on how to train a convolutional neural network (CNN) using the trainNetwork
function in MATLAB:
main.m891 chars29 lines
In this example, we used the Stochastic Gradient Descent with Momentum (SGDM) optimizer, the maximum number of epochs as 20, and specified to validate the network on the testing data every 30 iterations. The training-progress
option will show the progress of training in a nice progress bar.
You can modify the architecture, as well as the training options, depending on your problem and data. It's always best to experiment with different architectures and parameters to find the best model for your data.
gistlibby LogSnag