Explore modules

Proximal Soft Thresholding

Visualize L1 proximal soft thresholding and compare it with L2 regularization.

Free theory article

Visualize 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.

  1. Set Input v1 to 3 and Input v2 to -1.
  2. Set Penalty lambda to 1.
  3. Leave Penalty as L1. Observe that x2 becomes exactly 0 (Sparsity).
  4. Change Penalty to L2. Observe the solution shifts to (1.5, -0.5), meaning no coordinate is exactly zero.
  5. In Penalty = L2, set Penalty lambda to 0.5. Read solution (2, -2/3) and objective 5/3 = 1.666667; L2 results are not restricted to halves or quarters.
  6. Restore L1 and set lambda to 4: both coordinates are zero and the objective is 5. At lambda 0, the input and solution coincide and objective is zero.
Read the full free theory article