Exemplo n.º 1
0
        public void TestEP_NearestNeighborsLPBc()
        {
            using (var env = EnvHelper.NewTestEnvironment(conc: 1))
            {
                var iris = FileHelper.GetTestFile("iris_binary.txt");
                var df   = DataFrameIO.ReadCsv(iris, sep: '\t', dtypes: new ColumnType[] { NumberType.R4 });

                var importData       = df.EPTextLoader(iris, sep: '\t', header: true);
                var learningPipeline = new GenericLearningPipeline(conc: 1);
                learningPipeline.Add(importData);
                learningPipeline.Add(new Legacy.Transforms.ColumnConcatenator("Feat", "Sepal_length", "Sepal_width"));
                var node = new Scikit.ML.EntryPoints.NearestNeighborsBinary("Feat", "Label", null);
                learningPipeline.Add(node);
                var predictor   = learningPipeline.Train();
                var predictions = predictor.Predict(df);
                var dfout       = DataFrameIO.ReadView(predictions);
                Assert.AreEqual(dfout.Shape, new Tuple <int, int>(150, 9));
            }
        }
 public static void Add(this Microsoft.ML.Runtime.Experiment exp, NearestNeighborsBinary input, NearestNeighborsBinary.Output output)
 {
     exp.AddEntryPoint(NearestNeighborsBinary.Name, input, output);
 }
        public static NearestNeighborsBinary.Output Add(this Microsoft.ML.Runtime.Experiment exp, NearestNeighborsBinary input)
        {
            var output = new NearestNeighborsBinary.Output();

            exp.Add(input, output);
            return(output);
        }