Questions about the regularization (Modified Performance Function) of neural network
Mostrar comentarios más antiguos
Hello, everyone. I tried to find out the best regularization ratio for a very simple problem from Matlab, using the function trainbgf for a shallow neural network. Then I plotted a validation curve. The problem is that the curve didn't make any sense. I just followed the contents from the official document as follows:

Here are my codes.
*******************************************
regularization_term = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1];
m = size(regularization_term,2);
[x,t] = simplefit_dataset;
x_train = x(1:70);
t_train = t(1:70);
x_test = x(71:94);
t_test = t(71:94);
trainPerformance = zeros(50,11);
testPerformance = zeros(50,11);
for j = 1:50
for i = 1:m
net = feedforwardnet(10,'trainbfg');
net.divideFcn = '';
net.trainParam.epochs = 300;
net.trainParam.goal = 1e-5;
net.performParam.regularization = regularization_term(i);
net = train(net,x_train,t_train);
y_train = net(x_train);
trainPerformance(j,i) = sqrt(perform(net,t_train,y_train));
y_test = net(x_test);
testPerformance(j,i) = sqrt(perform(net,t_test,y_test));
end
end
plot(regularization_term, mean(trainPerformance),regularization_term,mean(testPerformance))
legend('trainperformance-RMSE','testperformacne-RMSE','best')
xlabel('Regularization Ratio')
ylabel('RMSE')
************************************************
Here is the learning curve I plotted.

I think that the RMSE of the training data should increase as the regularization ratio increases and the RMSE of the test data should decrease at first and at a certain point start to increase as the regularization ratio increases. I'm not sure where I made a mistake, can anyone give me advice? Thank you in advance!
2 comentarios
Greg Heath
el 23 de Ag. de 2018
What is the URL of your
"OFFICIAL DOCUMENT" ???
Greg
Respuesta aceptada
Más respuestas (1)
Greg Heath
el 24 de Ag. de 2018
% When I search the command line window for info on "regularization" :
>> help regularization
regularization not found.
Use the Help browser search field to search the documentation, or type "help help" for help command options, such as help for methods.
>> doc regularization
% No answer!
>> lookfor regularization
plotbr - Plot network performance for Bayesian regularization training.
trainbr - Bayesian Regularization backpropagation.
msereg - Mean squared error with regularization performance function.
msnereg - Mean squared normalized error with regularization performance function.
lasso - Perform lasso regularization for linear regression on tall arrays.
lassoglm - Perform lasso or elastic net regularization for a generalized linear model.
lasso - Perform lasso or elastic net regularization for linear regression.
% Therefore, it seems that for general
%(i.e., nonlinear) applications
%
% USE TRAINBR WITH MSEREG
%
% I will let you do the rest. First see the results of the following commands
>> help trainbr
>> doc trainbr
Hope this helps.
THANK YOU FOR FORMALLY ACCEPTING MY ANSWER
Greg
Categorías
Más información sobre Gaussian Process Regression en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

