Exemplo n.º 1
0
    public async Task GetPrediction(float[] image)
    {
        var digit      = MinstDigit.FromList(image, false);
        var prediction = ml.Predict(digit);

        prediction.Label = prediction.Score.Select((value, index) => new { Value = value, Index = index }).Aggregate((a, b) => (a.Value > b.Value) ? a : b).Index;
        await Clients.Caller.SendAsync("receivePrediction", image, prediction);

        await Clients.All.SendAsync("receiveBackground", image, prediction);
    }
Exemplo n.º 2
0
        public MLModel()
        {
            var pipeline = new LearningPipeline();

            string dataPath = "./train.csv";

            pipeline.Add(new TextLoader(dataPath).CreateFrom <MinstDigit>(separator: ',', useHeader: true));

            pipeline.Add(new ColumnConcatenator("Features", MinstDigit.GetColumnNames()));

            pipeline.Add(new StochasticDualCoordinateAscentClassifier());


            _model = pipeline.Train <MinstDigit, MinstPrediction>();



            this.Evaluate();
            //this.Export();
        }
Exemplo n.º 3
0
 public MinstPrediction Predict(MinstDigit digit)
 {
     return(_model.Predict(digit));
 }