private double computeGain(DecisionNode node)
{
if (node.IsLeaf) return Double.NegativeInfinity;
// Compute the sum of misclassifications at the children
double sum = 0;
foreach (var child in node.Branches)
sum += info[child].error;
// Get the misclassifications at the current node
double current = info[node].error;
// Compute the expected gain at the current node:
return sum - current;
}