Trying to predict a value by giving the model a sample data. In ML.NET it automatically selects the first row of the training data as sample data. I want to select another row or rows but I cant write the values by hand because there are too many columns(239 to be exact).
I tried converting the data which I read from a csv file to IEnumerable and then predict each using foreach.
var data = mlContext.Data.LoadFromTextFile<MLModel1.ModelInput (@"csv file path", ';', true);
IEnumerable<MLModel1.ModelInput> dataEnumerable = mlContext.Data.CreateEnumerable<MLModel1.ModelInput>(data, reuseRowObject: false);
foreach (var item in dataEnumerable)
{
Console.WriteLine();
Console.WriteLine("Gerçek Puan: " + item.Puan);
var sortedScoresWithLabel = MLModel1.PredictAllLabels(item);
Console.WriteLine($"{"Class",-40}{"Score",-20}");
Console.WriteLine($"{"-----",-40}{"-----",-20}");
foreach (var score in sortedScoresWithLabel)
{
Console.WriteLine($"{score.Key,-40}{score.Value,-20}");
}
}
It works but CreateEnumerable method converts some values to NaN randomly. Is there a fix?