The Predictor class, much like what was changed in the linear regression example, is simply modified to support the new model and return the classification:
We begin by passing in the two new classes, FileInput and FilePrediction,to the CreatePredictionEngine method:
var predictionEngine = MlContext.Model.CreatePredictionEngine<FileInput, FilePrediction>(mlModel);
Next, we create the FileInput object, setting the Strings property with the return value of the GetStrings method we wrote earlier:
var prediction = predictionEngine.Predict(new FileInput { Strings = GetStrings(File.ReadAllBytes(inputDataFile)) });
Finally, we update the output call to the Console object with our file classification and probability:
Console.WriteLine( $"Based on the file ({inputDataFile}) the file is classified as {(prediction.IsMalicious ? "malicious" : "benign")}" + $" at a confidence level of {prediction.Probability:P0}");