Accord.MachineLearning.DecisionTrees.Pruning.ReducedErrorPruning.computeGain C# (CSharp) Method

computeGain() private method

private computeGain ( DecisionNode node ) : double
node DecisionNode
return double
        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;
        }