Proximal Soft Thresholding
Visualize L1 proximal soft thresholding and compare it with L2 regularization.
Free theory articleVisualize L1 proximal soft thresholding and compare it with L2 regularization.
Concept & interpretation
Proximal operators are a key tool for solving optimization problems with non-differentiable penalty terms. The proximal soft thresholding operator corresponds to the L1 penalty, yielding exact zero coefficients (sparsity). The L2 proximal operator instead scales each coordinate by 1/(1 + lambda). An initially zero coordinate stays zero; a nonzero coordinate remains nonzero for finite supported lambda.
Experiment
Use the Proximal Soft Thresholding module to observe the difference between L1 and L2 penalties.
- Set Input v1 to 3 and Input v2 to -1.
- Set Penalty lambda to 1.
- Leave Penalty as L1. Observe that x2 becomes exactly 0 (Sparsity).
- Change Penalty to L2. Observe the solution shifts to (1.5, -0.5), meaning no coordinate is exactly zero.
- In Penalty = L2, set Penalty lambda to
0.5. Read solution(2, -2/3)and objective5/3 = 1.666667; L2 results are not restricted to halves or quarters. - Restore L1 and set lambda to
4: both coordinates are zero and the objective is5. At lambda0, the input and solution coincide and objective is zero.