public void TestOldSavingAndLoading()
        {
            var data = new[] { new TestClass()
                               {
                                   A = "1", B = "2", C = "3",
                               }, new TestClass()
                               {
                                   A = "4", B = "5", C = "6"
                               } };
            var dataView = ComponentCreation.CreateDataView(Env, data);
            var pipe     = new CategoricalHashEstimator(Env, new[] {
                new CategoricalHashEstimator.ColumnInfo("A", "CatHashA"),
                new CategoricalHashEstimator.ColumnInfo("B", "CatHashB"),
                new CategoricalHashEstimator.ColumnInfo("C", "CatHashC")
            });
            var result      = pipe.Fit(dataView).Transform(dataView);
            var resultRoles = new RoleMappedData(result);

            using (var ms = new MemoryStream())
            {
                TrainUtils.SaveModel(Env, Env.Start("saving"), ms, null, resultRoles);
                ms.Position = 0;
                var loadedView = ModelFileUtils.LoadTransforms(Env, dataView, ms);
            }
        }
        public void TestMetadataPropagation()
        {
            var data = new[] {
                new TestMeta()
                {
                    A = new string[2] {
                        "A", "B"
                    }, B = "C", C = new float[2] {
                        1.0f, 2.0f
                    }, D = 1.0f, E = new string[2] {
                        "A", "D"
                    }, F = "D"
                },
                new TestMeta()
                {
                    A = new string[2] {
                        "A", "B"
                    }, B = "C", C = new float[2] {
                        3.0f, 4.0f
                    }, D = -1.0f, E = new string[2] {
                        "E", "A"
                    }, F = "E"
                },
                new TestMeta()
                {
                    A = new string[2] {
                        "A", "B"
                    }, B = "C", C = new float[2] {
                        5.0f, 6.0f
                    }, D = 1.0f, E = new string[2] {
                        "D", "E"
                    }, F = "D"
                }
            };

            var dataView = ComponentCreation.CreateDataView(Env, data);
            var bagPipe  = new CategoricalHashEstimator(Env,
                                                        new CategoricalHashEstimator.ColumnInfo("A", "CatA", CategoricalTransform.OutputKind.Bag, invertHash: -1),
                                                        new CategoricalHashEstimator.ColumnInfo("B", "CatB", CategoricalTransform.OutputKind.Bag, invertHash: -1),
                                                        new CategoricalHashEstimator.ColumnInfo("C", "CatC", CategoricalTransform.OutputKind.Bag, invertHash: -1),
                                                        new CategoricalHashEstimator.ColumnInfo("D", "CatD", CategoricalTransform.OutputKind.Bag, invertHash: -1),
                                                        new CategoricalHashEstimator.ColumnInfo("E", "CatE", CategoricalTransform.OutputKind.Ind, invertHash: -1),
                                                        new CategoricalHashEstimator.ColumnInfo("F", "CatF", CategoricalTransform.OutputKind.Ind, invertHash: -1),
                                                        new CategoricalHashEstimator.ColumnInfo("A", "CatG", CategoricalTransform.OutputKind.Key, invertHash: -1),
                                                        new CategoricalHashEstimator.ColumnInfo("B", "CatH", CategoricalTransform.OutputKind.Key, invertHash: -1),
                                                        new CategoricalHashEstimator.ColumnInfo("A", "CatI", CategoricalTransform.OutputKind.Bin, invertHash: -1),
                                                        new CategoricalHashEstimator.ColumnInfo("B", "CatJ", CategoricalTransform.OutputKind.Bin, invertHash: -1));

            var bagResult = bagPipe.Fit(dataView).Transform(dataView);

            ValidateMetadata(bagResult);
            Done();
        }
        public void CategoricalHashWorkout()
        {
            var data = new[] { new TestClass()
                               {
                                   A = "1", B = "2", C = "3",
                               }, new TestClass()
                               {
                                   A = "4", B = "5", C = "6"
                               } };

            var dataView = ComponentCreation.CreateDataView(Env, data);
            var pipe     = new CategoricalHashEstimator(Env, new[] {
                new CategoricalHashEstimator.ColumnInfo("A", "CatA", CategoricalTransform.OutputKind.Bag),
                new CategoricalHashEstimator.ColumnInfo("A", "CatB", CategoricalTransform.OutputKind.Bin),
                new CategoricalHashEstimator.ColumnInfo("A", "CatC", CategoricalTransform.OutputKind.Ind),
                new CategoricalHashEstimator.ColumnInfo("A", "CatD", CategoricalTransform.OutputKind.Key),
            });

            TestEstimatorCore(pipe, dataView);
            Done();
        }