none
Incorporating Machine Learning (ML.NET) in Windows Form RRS feed

  • Question

  • Hi,

    I can't find a Forum for ML.Net users.  So I'm placing it here.  Sorry, if this is not the appropriate place.

    I've created an ML Model that predicts a result (True/False) given some data.

    Now, I want to incorporate this ML Model in my Windows form data whereby I specify a CSV file with several lines of data and I'd like the result to be written after each line (whether True of False).

    I've followed sample from here.

    But I'm getting File not found exception as follows:

    System.IO.FileNotFoundException:
    'Could not load file or assembly 'Microsoft.ML.Data, Version=1.0.0.0,
    Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
    The system cannot find the file specified.'

    Following is my code snippet:

    private void PerformTest(string inputFile)
            { 
                //Open and read input file
                List<string> testData =  LoadCsvFile(inputFile);
               
                var input = new ModelInput();
    
                foreach (string item in testData.Skip(1))
                {
                    if (item != null)
                    {
                        string[] line = item.Split(',');                    
    
                        input.RUNOFF = Convert.ToSingle(line[0]);
                        input.WATERYLD = Convert.ToSingle(line[1]);
                        input.ET = Convert.ToSingle(line[2]);
                        input.SLOPE = Convert.ToSingle(line[3]);
                        input.AREASQKM = Convert.ToSingle(line[4]);                                    
                    }
    
                    // Make a single prediction on the sample data and print results
                    ModelOutput predictionResult = ConsumeModel.Predict(input);   //ERROR HERE:  FileNotFound
                    input.ISTERRACE = predictionResult.Prediction;
                }
    
            }

    I still need to write the results into a text file which I haven't done yet.

    I'm not sure why it's looking for Microsoft.ML version 1.0.0 when the ML Model I created is using Microsoft.ML version 1.5.0.


    Marilyn Gambone

    Thursday, April 2, 2020 4:35 PM

Answers

All replies