The Distribution of Relaxation Times (DRT) is an approach of particular interest to the interpretation of Electrochemical Impedance Spectroscopy (EIS) measurements. The DRT allows direct access to the time characteristics of the electrochemical system under study. Obtaining the DRT from noisy EIS data requires solving an ill-posed problem using regularization methods. In this work we investigate the optimal choice of the regularization parameter in the case of ridge regression. For this purpose we propose two novel sets of test functions known as real and imaginary discrepancy test function, and real and imaginary cross-validation test functions. Furthermore, we show the validity of these tests with synthetic and real experiments. By applying the optimal regularization parameters, the DRT results from the synthetic experiments (an RC circuit, a ZARC, and a fractal element) successfully reproduce the known exact DRT. Additionally, in the cases taken from electrochemical practice (a collection of RC circuits, a symmetric cell, and a commercial Li-ion battery) our approach confirms the ability to identify various timescales. Additionally, we study the output of the regularization using Least Absolute Shrinkage and Selection Operator (Lasso) and we highlight the added value given by the synergetic use of Lasso and ridge regression.