Accord.MachineLearning.DecisionTrees.RandomForestLearning.run C# (CSharp) Method

run() private method

private run ( double inputs, int output ) : double
inputs double
output int
return double
        private double run(double[][] inputs, int[] output)
        {
            int rows = inputs.Length;
            int cols = inputs[0].Length;
            int classes = output.DistinctCount();

            int colsPerTree;

            if (CoverageRatio == 0)
            {
                colsPerTree = (int)(System.Math.Sqrt(cols));
            }
            else
            {
                colsPerTree = (int)(cols * CoverageRatio);
            }

            var trees = forest.Trees;
            int[] idx = Classes.Random(output, classes, trees.Length);

            Parallel.For(0, trees.Length, i =>
            {
                var x = inputs.Get(idx);
                var y = output.Get(idx);

                var c45 = new C45Learning(forest.Trees[i])
                {
                    MaxVariables = colsPerTree,
                    Join = 100
                };

                c45.Learn(x, y);
            });

            return 0;
        }