  The properties of the matter density field in the initial conditions have a
decisive impact on the features of the large-scale structure of the Universe as
observed today. These need to be studied via $N$-body simulations, which are
imperative to analyze high density collapsed regions into dark matter halos. In
this paper, we train Machine Learning algorithms with information from N -body
simulations to infer two properties: dark matter particle halo classification
that leads to halo formation prediction with the characteristics of the matter
density field traced back to the initial conditions, and dark matter halo
formation by calculating the Halo Mass Function (HMF), which offers the number
density of dark matter halos with a given threshold. We map the initial
conditions of the matter density field into classification labels of dark
matter halo structures. The Halo Mass Function of the simulations is calculated
and reconstructed with theoretical methods as well as our trained algorithms.
We test several Machine Learning techniques where we could find that the Random
Forest and Neural Networks proved to be the better performing tools to classify
dark matter particles in cosmological simulations. We also show that that it is
not compulsory to use a high amount of data to train the algorithms in order to
reconstruct the HMF, giving us a very good fitting function for both simulation
and theoretical results.
