Refactor and fix ridgeRegressionAuto