1
0
forked from s425077/PotatoPlan

Merge branch 'Joel-ML' of https://git.wmi.amu.edu.pl/s425077/PotatoPlan into Joel-ML

This commit is contained in:
Joel 2020-05-25 11:08:14 +02:00
commit 631ad7c12f
6 changed files with 17 additions and 17 deletions

View File

@ -172,7 +172,7 @@ namespace Game1
Time.updateTime(tractorUnit.getSpeed());
//System.Threading.Thread updatethread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(Update));
base.Update(gameTime);
}

View File

@ -11,7 +11,7 @@ using Microsoft.ML.Trainers.LightGbm;
class MLModel
{
private static MLContext mlContext = new MLContext(seed: 1);
/*
private static string path = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/Fertilizer_Prediction.csv";
private static string modelpath = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/MLmodel";
private static string report = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/report";
@ -19,7 +19,7 @@ class MLModel
private static string pathBig = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/BigFertPredict.csv";
private static string modelpathBig = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/MLmodelBig";
private static string reportBig = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/report_BigModel";
*/
/*
private static string pathBig = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/BigFertPredict.csv";
private static string modelpathBig = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/MLmodelBig";
private static string reportBig = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/report_BigModel";
@ -27,7 +27,7 @@ class MLModel
private static string path = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/Fertilizer_Prediction.csv";
private static string modelpath = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/MLmodel";
private static string report = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/report";
*/
// Loading data, creatin and saving ML model for smaller dataset (100)
public static void CreateModel()
{

View File

@ -9,12 +9,7 @@ namespace Game1.Sources.ML_Joel
{
class OutputArea
{
//[ColumnName("PredictedLabel")]
public float Prediction { get; set; }
public float Score { get; set; }
//[ColumnName("Score")]
// public float[] Score { get; set; }
}
}

View File

@ -41,7 +41,7 @@ namespace Game1.Sources.ML_Joel
{
Season = Time.getTimeOfYear(),
Area = soilProperties.Area,
Rainfall = soilProperties.Humidity,
Rainfall = soilProperties.prevRainfall,
};
OutputArea modelOutput = new OutputArea();

View File

@ -13,19 +13,24 @@ namespace Game1.Sources.ML_Joel
class Model
{
private static MLContext mlContext = new MLContext(seed: 1);
private static string path = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/Rainfall.csv";
private static string modelpath = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/MLmodel_Joel";
private static string report = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/report_Joel";
private static string path_area = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/Rainfall_area.csv";
private static string modelpath_area = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/MLmodel_Joel_area";
private static string report_area = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/report_Joel_area";
/*
private static string path = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/Rainfall.csv";
private static string modelpath = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/MLmodel_Joel";
private static string report = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/report_Joel";
*/
private static string path = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/Rainfall.csv";
private static string modelpath = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/MLmodel_Joel";
private static string report = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/report_Joel";
private static string path_area = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/Rainfall_area.csv";
private static string modelpath_area = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/MLmodel_Joel_area";
private static string report_area = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/report_Joel_area";
*/
// Loading data, creatin and saving ML model for smaller dataset (100)
public static void CreateModel()
{
@ -142,7 +147,7 @@ namespace Game1.Sources.ML_Joel
var eval = mlContext.Regression.Evaluate(trainingDataView, labelColumnName: labelColumnName);
var report = File.CreateText(reportPath);
report.Write("Mean Absolute Error: " + eval.MeanAbsoluteError + '\n' + "Mean Squared Error: " + eval.MeanSquaredError + '\n' + "R Squared: " + eval.RSquared, 0, 0);
report.Write("Mean Absolute Error: " + eval.MeanAbsoluteError + '\n' + "R Squared: " + eval.RSquared, 0, 0);
report.Flush();
report.Close();
}