Ejemplo n.º 1
0
        public void GaussDeNormalizationTestsn_test1()
        {
            // Creates learning api object
            LearningApi api = new LearningApi(loadMetaData1());

            //Real dataset must be defined as object type, because data can be numeric, binary and classification
            api.UseActionModule <object[][], object[][]>((input, ctx) =>
            {
                return(GetRealDataSample());
            });

            //this call must be first in the pipeline
            api.UseDefaultDataMapper();

            //
            api.UseGaussNormalizer();

            //use denormalizer on normalized data
            api.UseGaussDeNormalizer();

            //
            var result = api.Run() as double[][];


            //Test result for normalization
            var expected = GetTransformedNumericDataSample();

            for (int i = 0; i < expected.Length; i++)
            {
                for (int j = 0; j < expected[0].Length; j++)
                {
                    Assert.Equal(Math.Round(result[i][j], 4), expected[i][j]);
                }
            }

            //
            return;
        }