Skip to content

Do any of the models allow for L2 Regularization? #443

Answered by manujosephv
mg10011 asked this question in Q&A
Discussion options

You must be logged in to vote

Typically, in PyTorch L2 Regularisation is applied using weight decay
Use weight_decay > 0 for L2 regularization:

optimizer = torch.optim.Adam(model.parameters(), lr=1e-4, weight_decay=1e-5)

Although this doesn't work like a Lasso Regression and necessarily gives you a sparse usage of features...

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mg10011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants