L2 regularization

Applies to: python, general

L2 regularization adds a penalty proportional to squared parameter values, discouraging large weights.

penalty = np.sum(w ** 2)

See also: regularization