Lasso regression works by adding a penalty equivalent to the absolute value of the magnitude of coefficients to the cost function. This penalty term, controlled by a hyperparameter lambda (λ), forces some of the coefficients to be exactly zero. The optimization problem it solves can be expressed as:
Minimize (Sum of squared errors + λ * Sum of absolute values of coefficients)
The hyperparameter λ controls the strength of the penalty; larger values of λ result in more coefficients being shrunk to zero, leading to simpler models.