Accord.Tests.MachineLearning.ErrorBasedpruningTest.repeat C# (CSharp) Method

repeat() private static method

private static repeat ( double inputs, int outputs, Accord.MachineLearning.DecisionTrees.DecisionTree tree, int training, double threshold, int &nodeCount2 ) : void
inputs double
outputs int
tree Accord.MachineLearning.DecisionTrees.DecisionTree
training int
threshold double
nodeCount2 int
return void
        private static void repeat(double[][] inputs, int[] outputs,
            DecisionTree tree, int training, double threshold,
            out int nodeCount2)
        {
            int nodeCount = 0;
            foreach (var node in tree)
                nodeCount++;

            var pruningInputs = inputs.Submatrix(training, inputs.Length - 1);
            var pruningOutputs = outputs.Submatrix(training, inputs.Length - 1);
            ErrorBasedPruning prune = new ErrorBasedPruning(tree, pruningInputs, pruningOutputs);

            prune.Threshold = threshold;

            double lastError;
            double error = Double.PositiveInfinity;

            do
            {
                lastError = error;
                error = prune.Run();
            } while (error < lastError);

            nodeCount2 = 0;
            foreach (var node in tree)
                nodeCount2++;
        }
    }
ErrorBasedpruningTest