I am using Regression Learner App for training the Neural Network. I want to know how to specify the batch size, select adam optimizer and also where to select loss function?

11 views (last 30 days)
In regression learner app, where can we select these options?
  1. Batch size
  2. Optimizer slection(for ex: adam optimizer)
  3. Loss Function

Accepted Answer

Abhipsa
Abhipsa on 7 Mar 2025
In the Regression Learner App, when utilizing Neural Networks as the model, you have several hyperparameter options. However, there are no available options for adjusting the batch size, optimizers, or loss functions.
A suitable workaround to avail the stated options would be to use trainingOptions function in the Deep Learning Toolbox.
You can refer to the below code snippet for a better understanding:
% Specify the neural network architecture
layers = [
featureInputLayer(1) % Input layer for 1 feature
fullyConnectedLayer(10) % Fully connected layer with 10 neurons
reluLayer % Activation function (ReLU)
fullyConnectedLayer(1) % Output layer (1 neuron for regression)
regressionLayer]; % Regression output layer
% Specify the training options according to your requirements
options = trainingOptions('adam', ... % Optimizer (Adam)
'MaxEpochs', 50, ... % Number of epochs
'MiniBatchSize', 10, ... % Batch size
'InitialLearnRate', 0.01, ... % Learning rate
'Plots', 'training-progress', ... % Plot training progress
'Verbose', false); % Suppress command window output
% Train the network
net = trainNetwork(data, layers, options);
For more information, you can refer to the below given MATLAB Documentations for the same:
I hope this resolves your query.

More Answers (0)

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!