I am trying to applying batch predictions as shown within the Binary Classification, example to a Multi Class Classification
Many of the examples demonstrated across google and Microsoft work, show a single prediction to demonstrate the capability of a trained model.
However, I am looking to demonstrate the effectiveness of a trained model through batch predicting a) multi manual entries and b) using a file with no labels.
I have followed the Binary Classification example and trying to map it across to the Multi Class Classification example, however, the predictions are not showing.
The following is a single prediction as shown in the Multi Class Classification example
// Single Prediction
ITransformer loadedModel = _mlContext.Model.Load(_modelPath, out var modelInputSchema);
GitHubIssue singleIssue = new GitHubIssue() { Title = "Entity Framework crashes", Description = "When connecting to the database, EF is crashing" }; // Our single issue
_predEngine = _mlContext.Model.CreatePredictionEngine<GitHubIssue, IssuePrediction>(loadedModel);
var singleprediction = _predEngine.Predict(singleIssue);
Console.WriteLine($"=============== Single Prediction - Result: {singleprediction.Area} ===============");
The following is batch prediction as shown in the Binary Classification example, however, does not work in the scenario.
// Batch Predictions from Enumerable
ITransformer loadedModel = _mlContext.Model.Load(_modelPath, out var modelInputSchema);
IDataView batchIssues = _mlContext.Data.LoadFromEnumerable(issues);
IDataView predictions = loadedModel.Transform(batchIssues);
IEnumerable<GitHubIssue> predictedResults = _mlContext.Data.CreateEnumerable<GitHubIssue>(predictions, reuseRowObject: false);
foreach (GitHubIssue prediction in predictedResults)
{
Console.WriteLine($"Title: {prediction.Title} | Prediction: {prediction.Area}");
}
Following the single prediction I get the result of:
area-System.Data
While the batch processing does not predict an output, as I don't think it is predicting, however, reading the material found on Microsofts ML.NET website it says transform will use the model to make the predictions across the batch of data.
"Use the model to predict the comment data sentiment using the Transform() method"
Problem 1) I am unsure, what I am missing within the batch prediction enumerable to get the predictions of prediction.area as shown in the single value.
Problem 2) How I would adapt the enumerable to load in a file of unlabelled information to make predictions on.