forked from s425077/PotatoPlan
fixes
This commit is contained in:
parent
94c2792ef3
commit
0b7ff8a949
@ -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);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ class Farm
|
||||
private float[][] whiteNoise;
|
||||
private float[][] perlinNoise;
|
||||
private DayNightCycle Time;
|
||||
private float updatePerc = 0.25f;
|
||||
private float updatePerc = 0.5f;
|
||||
private float updateProgress = 0;
|
||||
private int nextUpdate = 0;
|
||||
private int productionUpdate = 0;
|
||||
@ -147,13 +147,14 @@ class Farm
|
||||
crops[i, j].updateProductionRate();
|
||||
}
|
||||
}
|
||||
updateProgress = updateProgress + updatePerc;
|
||||
updateProgress = updateProgress + nextUpdate;
|
||||
if (updateProgress > 1)
|
||||
{
|
||||
updateProgress = 0;
|
||||
}
|
||||
updateRainMapPosition(Size);
|
||||
productionUpdate = 0;
|
||||
nextUpdate = 0;
|
||||
}
|
||||
productionUpdate++;
|
||||
}
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace Game1.Sources.ML_Joel
|
||||
{
|
||||
Season = Time.getTimeOfYear(),
|
||||
Area = soilProperties.Area,
|
||||
Rainfall = soilProperties.Humidity,
|
||||
Rainfall = soilProperties.prevRainfall,
|
||||
};
|
||||
|
||||
return PredictionEngineArea.Predict(modelInput).Score;
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user