using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.ML; namespace Game1.Sources.ML_Joel { static class Engine { private static MLContext mlContext = new MLContext(seed: 1); private static PredictionEngine PredictionEngine; private static PredictionEngine PredictionEngineArea; public static void CreateModel() { Model.CreateModel(); } public static void CreateModelArea() { Model.CreateModelArea(); } public static void init() { PredictionEngine = Model.CreateEngine(); } public static void initArea() { PredictionEngineArea = Model.CreateEngineArea(); } public static float PredictProductionwithRainfall(Crops crop, CropTypes cropTypes) { InputArea modelInput = new InputArea { //Season = crop. //Area = crop.getSoilProperties().Area, Rainfall = crop.getSoilProperties().Humidity, }; return PredictionEngineArea.Predict(modelInput).Score; } } }