Accord.Tests.Statistics.BranchingFilterTest.ApplyTest C# (CSharp) Method

ApplyTest() private method

private ApplyTest ( ) : void
return void
        public void ApplyTest()
        {
            object[,] data = 
            {
                { "Id", "IsSmoker", "Age" },
                {   0,       1,        10  },
                {   1,       1,        15  },
                {   2,       0,        40  },
                {   3,       1,        20  },
                {   4,       0,        70  },
                {   5,       0,        55  },
            };

            DataTable input = data.ToTable();

            var smoker = new LinearScaling();
            var common = new LinearScaling();

            smoker.Columns.Add(new LinearScaling.Options("Age")
            {
                SourceRange = new DoubleRange(10, 20),
                OutputRange = new DoubleRange(-1, 0)
            });

            common.Columns.Add(new LinearScaling.Options("Age")
            {
                SourceRange = new DoubleRange(40, 70),
                OutputRange = new DoubleRange(0, 1)
            });


            var settings = new Branching.Options("IsSmoker");
            settings.Filters.Add(1, smoker);
            settings.Filters.Add(0, common);

            Branching branching = new Branching(settings);



            DataTable actual = branching.Apply(input);

            double[] expected = { -1, -0.5, 0, 0, 1, 0.5 };

            foreach (DataRow row in actual.Rows)
            {
                int id = (int)row[0];
                double age = (double)row[2];
                Assert.AreEqual(expected[id], age);
            }

        }
    }
BranchingFilterTest