Context. Regression methods based in Machine Learning Algorithms (MLA) have become an important tool for data analysis in many different disciplines. Aims. In this work, we use MLA in an astrophysical context; our goal is to measure the mean longitudinal magnetic field in stars (H eff ) from polarized spectra of high resolution, through the inversion of the so-called multi-line profiles. Methods. Using synthetic data, we tested the performance of our technique considering different noise levels: In an ideal scenario of noise-free multi-line profiles, the inversion results are excellent; however, the accuracy of the inversions diminish considerably when noise is taken into account. In consequence, we propose a data pre-process in order to reduce the noise impact, which consists in a denoising profile process combined with an iterative inversion methodology. Results. Applying this data pre-process, we have found a considerable improvement of the inversions results, allowing to estimate the errors associated to the measurements of stellar magnetic fields at different noise levels. Conclusions. We have successfully applied our data analysis technique to two different stars, attaining by first time the measurement of H eff from multi-line profiles beyond the condition of line autosimilarity assumed by other techniques.