how to use L1 regularization instead of L2 in train()
7 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
prabhat kumar sharma
2024-2-13
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!