Ensemble methods were introduced in a previous tutorial. In this tutorial we will explore two more ensemble learning algorithms, namely - stacking and mixture of experts. Both these methods can be looked at as examples of meta learning, when machine learning models are trained on data from predictions outputted by other machine learning models.
Let us continue with the scenario where m models are trained on a dataset of n samples. Stacking (or stacked generalization) builds the models in the ensemble using different learning algorithms (e.g. one neural network, one decision tree, ...), as opposed to bagging or boosting that train various incarnations of the same learner (e.g. all decision trees).
The outputs of the models are combined to compute the ultimate prediction of any instance x:
Whereas boosting sequentially computes weights αj using an empirical formula, stacking introduces a level-1 algorithm, called meta-learner, for learning the weights βj of the level-0 predictors. That means, the m predictions of each training instance xi become now training data for the level-1 learner.
Although any machine learning technique can be used, the optimization problem typically involves least-squares regression:
Here, hj(-i) corresponds to the leave-one-out prediction generated by training hj over the subset of n-1 instances with the ith sample (xi, yi) left aside. Once optimal weights βj are estimated, base models hj are re-trained over the whole dataset and used to evaluate previously unseen instances x.
Based on the divide-and-conquer principle, mixture of experts (ME) trains individual models to become experts in different regions of the feature space. Then, a gating network (trainable combiner) decides which combination of ensemble learners is used to predict the final output of any instance x:
Here weights gj, called gating functions, are dynamically estimated through the gating network based on the current input data. They correspond to probabilities:
From the figure it is easy to see that this strategy resembles a neural network. Under this approach, experts (hidden nodes) can be chosen to be linear models with input weights θj: hj(x) = θjTx. Typically, the gating network is modeled by a softmax activation function for a soft switching between learners:
Although both techniques use a meta-learner to estimate the weights of the ensemble learners, they differ on the nature of this combiner. Stacking learns constant weights based on an optimization criterion by means of a machine learning algorithm (e.g. least-squares regression). Mixture-of-experts, on the other hand, is a gating network that assigns probabilities based on the current input data (weights are a function of x).
Stacking trains all learners on the entire dataset, whereas mixture-of-expert models specialize in different feature space partitions.