Skip to main content

l2_regularisation

Function l2_regularisation 

Source
pub fn l2_regularisation(weights: &[f64], lambda: f64) -> f64
Expand description

Compute L2 regularisation loss contribution.

Returns 0.5 * lambda * sum(w^2) for all elements of weights.