Merge branch 'Joel-ML' of https://git.wmi.amu.edu.pl/s425077/PotatoPlan into Joel-ML
This commit is contained in:
commit
631ad7c12f
@ -172,7 +172,7 @@ namespace Game1
|
|||||||
Time.updateTime(tractorUnit.getSpeed());
|
Time.updateTime(tractorUnit.getSpeed());
|
||||||
|
|
||||||
|
|
||||||
|
//System.Threading.Thread updatethread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(Update));
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ class Farm
|
|||||||
|
|
||||||
public float getProductionRate(int x, int y, int Type)
|
public float getProductionRate(int x, int y, int Type)
|
||||||
{
|
{
|
||||||
return crops[x, y].getProductionRate(PresetCrops.getPresetCropTypes(Type));
|
return crops[x, y]. getProductionRate(PresetCrops.getPresetCropTypes(Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetRandomNumber(double minimum, double maximum)
|
public float GetRandomNumber(double minimum, double maximum)
|
||||||
|
@ -11,7 +11,7 @@ using Microsoft.ML.Trainers.LightGbm;
|
|||||||
class MLModel
|
class MLModel
|
||||||
{
|
{
|
||||||
private static MLContext mlContext = new MLContext(seed: 1);
|
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 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 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";
|
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 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 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 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 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 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";
|
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 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 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";
|
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)
|
// Loading data, creatin and saving ML model for smaller dataset (100)
|
||||||
public static void CreateModel()
|
public static void CreateModel()
|
||||||
{
|
{
|
||||||
|
@ -9,12 +9,7 @@ namespace Game1.Sources.ML_Joel
|
|||||||
{
|
{
|
||||||
class OutputArea
|
class OutputArea
|
||||||
{
|
{
|
||||||
//[ColumnName("PredictedLabel")]
|
|
||||||
public float Prediction { get; set; }
|
public float Prediction { get; set; }
|
||||||
public float Score { get; set; }
|
public float Score { get; set; }
|
||||||
|
|
||||||
//[ColumnName("Score")]
|
|
||||||
// public float[] Score { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ namespace Game1.Sources.ML_Joel
|
|||||||
{
|
{
|
||||||
Season = Time.getTimeOfYear(),
|
Season = Time.getTimeOfYear(),
|
||||||
Area = soilProperties.Area,
|
Area = soilProperties.Area,
|
||||||
Rainfall = soilProperties.Humidity,
|
Rainfall = soilProperties.prevRainfall,
|
||||||
};
|
};
|
||||||
|
|
||||||
OutputArea modelOutput = new OutputArea();
|
OutputArea modelOutput = new OutputArea();
|
||||||
|
@ -13,19 +13,24 @@ namespace Game1.Sources.ML_Joel
|
|||||||
class Model
|
class Model
|
||||||
{
|
{
|
||||||
private static MLContext mlContext = new MLContext(seed: 1);
|
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 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 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 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 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 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";
|
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)
|
// Loading data, creatin and saving ML model for smaller dataset (100)
|
||||||
public static void CreateModel()
|
public static void CreateModel()
|
||||||
{
|
{
|
||||||
@ -142,7 +147,7 @@ namespace Game1.Sources.ML_Joel
|
|||||||
var eval = mlContext.Regression.Evaluate(trainingDataView, labelColumnName: labelColumnName);
|
var eval = mlContext.Regression.Evaluate(trainingDataView, labelColumnName: labelColumnName);
|
||||||
|
|
||||||
var report = File.CreateText(reportPath);
|
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.Flush();
|
||||||
report.Close();
|
report.Close();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user