We use Bayesian information criteria (BIC) (Schwarz, 1978) to choose the optimal number of components for training.
we train models by varying K and pick the one with the largest BIC given by log p(X, y|θ m )− |θm| 2 log N where θ m is the model with m components having |θ m | parameters, N is the number of data points and log p(X, y|θ m ) for fixed θ m is given by eq.