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

ReducedErrorPruning() public method

Initializes a new instance of the ReducedErrorPruning class.
public ReducedErrorPruning ( DecisionTree tree, double inputs, int outputs ) : System
tree DecisionTree The tree to be pruned.
inputs double The pruning set inputs.
outputs int The pruning set outputs.
return System
        public ReducedErrorPruning(DecisionTree tree, double[][] inputs, int[] outputs)
        {
            this.tree = tree;
            this.inputs = inputs;
            this.outputs = outputs;
            this.info = new Dictionary<DecisionNode, NodeInfo>();
            this.actual = new int[outputs.Length];

            foreach (var node in tree)
                info[node] = new NodeInfo();

            for (int i = 0; i < inputs.Length; i++)
                trackDecisions(tree.Root, inputs[i], i);
        }