PotatoPlan/Game1/Sources/ML_Joel/Engine.cs
2020-05-24 21:00:54 +02:00

52 lines
1.2 KiB
C#

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<Input, Output> PredictionEngine;
private static PredictionEngine<InputArea, OutputArea> 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 = ,
//Area = crop.getSoilProperties().Area,
Rainfall = crop.getSoilProperties().Humidity,
};
return PredictionEngineArea.Predict(modelInput).Score;
}
}
}