halos (with 445,983 total galaxies) in our sample which we use for our basic tests of the ML algorithms. However, since the Millennium semi-analytic model provides $b,v,r,i,z$ magnitudes and stellar masses for the galaxies, we can also use these same halos to learn the mapping between halo properties and $N_{gal}$ for different subpopulations of galaxies. We perform tests of the ML algorithms after splitting the halo sample on colour and stellar mass (a proxy for luminosity) in §\[sec:colour\] and §\[sec:mstar\] respectively.

Machine Learning Algorithms {#sec:ml}
===========================

We test 2 different machine learning (ML) algorithms for predicting $N_{gal}$ from the halo parameters $N_p$, $M_{200}$, $\sigma_v$, $v_{max}$, $R_{1/2}$ and spin. The first is a support vector machine (SVM) and the second is a k-nearest-neighbours (kNN) routine, both described below. They work by “learning” a relationship between a set of input features $\mathbf{X}$ and the value we’re interested in predicting $Y$. SVM and kNN are both non-parametric in the sense that we do not need to assume a model as traditional methods for populating halos with galaxies do. The mapping is constructed using information in the data itself: the data picks the model best suited to it. In addition, we avoid the messy 