how to use L1 regularization instead of L2 in train()

7 visualizaciones (últimos 30 días)
Jay Cheng
Jay Cheng el 18 de Mayo de 2015
Respondida: prabhat kumar sharma el 13 de Feb. de 2024
I hope to use L1 instead of L2 regularization in NN. I found that I can set lambda with net.performParam.regularization as: [x,t] = simplefit_dataset; net = feedforwardnet(10,'trainbfg'); net.divideFcn = ''; net.trainParam.epochs = 300; net.trainParam.goal = 1e-5; net.performParam.regularization = 0.5; net = train(net,x,t);
But I found there is no options to use L1 regularization instead of L2 norm in regularized cost function. I found some third party codes that use L1, but they are not as fast as the MATLAB built-in function, train(). Maybe because the train() uses parallel processing quite well.
My question: is there a quick and easy way to change NN training to use L1 regularization instead of the L2? If you can recommend some third party NN code in Matlab, that would be good too.
ps. I have looked up trainbr. Still forced to use L2
Many thanks

Respuestas (1)

prabhat kumar sharma
prabhat kumar sharma el 13 de Feb. de 2024
Hi Jay,
I understand you did not find any documentation for the L1 regularization while you find the below documentation for the L2 Regularization: https://www.mathworks.com/help/deeplearning/ref/nnet.cnn.layer.layer.setl2factor.html
In the Statistics and Machine Learning Toolbox, functions like lassoglm directly implement Lasso regression for linear models and generalized linear models, respectively.
I hope it helps!

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by