how to use L1 regularization instead of L2 in train()
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
prabhat kumar sharma
le 13 Fév 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.
You can find the documentation here: Lasso or elastic net regularization for generalized linear models - MATLAB lassoglm - MathWorks India
I hope it helps!
0 commentaires
Voir également
Catégories
En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!