In the l2 regularization model, as in the l1 regularization model, the regularization weight α is set by cross validation. In an embodiment, a logistic regression model with l2 regularization uses a backward feature selection procedure to select an optimal number of features. This feature selection procedure is the RFECV method for recursive feature elimination in Scikit-learn, a software machine-learning library for the Python programming language, available at https://github.com/scikit-learn/scikit-learn.
In various embodiments, both l1 and l2 regularization models fit a regularization hyperparameter using five folds for cross validation and searching across the seven parameters: [0, 0.001, 0.005, 0.01, 0.1, 0.5, 1]. In repeated iterations of model training, this range is restricted around previously successful settings.