Penalties
A penalty assigns a cost to optimization-scale coefficients. Intercepts are excluded, and strengths are already included in every penalty's value. All built-in strengths must be finite and nonnegative.
Penalty | Encourages |
|---|---|
Sparse individual coefficients | |
Small coefficients through a squared L2 cost | |
Sparsity together with quadratic shrinkage | |
Sparsity and equal coefficient magnitudes | |
Sparse, explicitly defined groups | |
Sparsity and equal signed effects | |
Sparsity and adjacent equal effects |
Use Scaled to multiply a complete penalty, Masked to exclude supported coordinates, and AxisPenalty to apply a vector penalty along coefficient-matrix axes.
Read the constraint plots
Each page shows the feasible region for a two-coordinate constrained problem,
The plots fix and shade the feasible region, including its boundary. Axes have equal scales and represent optimization coefficients, not reported original-scale coefficients. Captions specify every strength, weight, and group. The intercept does not appear in these plots.
For a penalized solution, choosing makes that solution optimal for the corresponding constrained problem. The budget is not the penalty multiplier: the appropriate correspondence depends on the data and the solution. Our fixed budget illustrates geometry rather than fitting a dataset. Zero strengths and unpenalized directions can give unbounded regions; arrows indicate continuation beyond the plotted window.
Compose supported capabilities
shrinkage::Penalty evaluates the complete cost. A compatible shrinkage::ProximalPenalty also minimizes
All seven base penalties provide this exact complete proximal map and work with proximal gradient. A sum does not acquire an exact map simply because its terms have individual maps. Other solvers need additional capabilities; see the compatibility table.
