Ridge Regression: implementation, theory and derivation of the formula