Accord.Tests.Statistics.NormalizationFilterTest.ApplyTest2 C# (CSharp) Method

ApplyTest2() private method

private ApplyTest2 ( ) : void
return void
        public void ApplyTest2()
        {
            string colName = "(test ['a'])";

            DataTable input = new DataTable("Sample data");
            input.Columns.Add(colName, typeof(double));
            input.Rows.Add(-2);
            input.Rows.Add(-1);
            input.Rows.Add(0);
            input.Rows.Add(1);
            input.Rows.Add(2);

            DataTable expected = new DataTable("Sample data");
            expected.Columns.Add(colName, typeof(double));
            expected.Rows.Add(-1.2649110640673518);
            expected.Rows.Add(-0.63245553203367588);
            expected.Rows.Add(0);
            expected.Rows.Add(0.63245553203367588);
            expected.Rows.Add(1.2649110640673518);



            Normalization target = new Normalization(colName);

            target.Detect(input);

            DataTable actual = target.Apply(input);

            for (int i = 0; i < actual.Rows.Count; i++)
            {
                double ex = (double)expected.Rows[i][0];

                double ax = (double)actual.Rows[i][0];

                Assert.AreEqual(ex, ax, 0.001);

            }
        }