Accord.Tests.MachineLearning.ID3LearningTest.LargeSampleTest1 C# (CSharp) Method

LargeSampleTest1() private method

private LargeSampleTest1 ( ) : void
return void
        public void LargeSampleTest1()
        {
            Accord.Math.Tools.SetupGenerator(0);

            int[][] dataSamples = Matrix.Random(500, 3, 0.0, 10.0).ToInt32().ToJagged();
            int[] target = Matrix.Random(500, 1, 0.0, 2.0).ToInt32().GetColumn(0);
            DecisionVariable[] features =
            {
                new DecisionVariable("Outlook",      10), 
                new DecisionVariable("Temperature",  10), 
                new DecisionVariable("Humidity",     10), 
            };


            DecisionTree tree = new DecisionTree(features, 2);
            ID3Learning id3Learning = new ID3Learning(tree);

            double error = id3Learning.Run(dataSamples, target);

            Assert.IsTrue(error < 0.2);

            var code = tree.ToCode("MyTree");


            Assert.IsNotNull(code);
            Assert.IsTrue(code.Length > 0);
        }