private float ProcessResults(ParameterSetting[] param) { TransitLines currentLines = new TransitLines(this.MacroOutputFile); var predicted = currentLines.Lines; var numberOfLines = predicted.Length; double rmse = 0; double mabs = 0; double terror = 0; float[] aggToTruth = new float[this.Truth.Length]; List <KeyValuePair <string, float> > Orphans = new List <KeyValuePair <string, float> >(); for (int i = 0; i < numberOfLines; i++) { int index = -1; bool orphan = true; for (int j = 0; j < this.Truth.Length; j++) { bool found = false; foreach (var line in predicted[i].ID) { if (this.Truth[j].ID.Contains(line)) { index = j; found = true; break; } } if (found) { orphan = false; aggToTruth[j] += predicted[i].Bordings; break; } } if (orphan) { Orphans.Add(new KeyValuePair <string, float>(predicted[i].ID[0], predicted[i].Bordings)); } } for (int i = 0; i < this.Truth.Length; i++) { var error = aggToTruth[i] - this.Truth[i].Bordings; rmse += error * error; mabs += Math.Abs(error); terror += error; } var value = this.EstimationAI.UseComplexErrorFunction ? this.EstimationAI.ComplexErrorFunction(this.Parameters, this.Truth, predicted, aggToTruth) : this.EstimationAI.ErrorCombinationFunction(rmse, mabs, terror); if (value < this.BestRunError) { SaveBordingData(aggToTruth, Orphans); this.BestRunError = value; } SaveEvaluation(param, value, rmse, mabs, terror); return(value); }
private float ProcessResults() { TransitLines currentLines = new TransitLines(MacroOutputFile); var predicted = currentLines.Lines; var numberOfLines = predicted.Length; double rmse = 0; double mabs = 0; double terror = 0; float[] aggToTruth = new float[Truth.Length]; List <KeyValuePair <string, float> > orphans = new List <KeyValuePair <string, float> >(); for (int i = 0; i < numberOfLines; i++) { bool orphan = true; for (int j = 0; j < Truth.Length; j++) { bool found = false; foreach (var line in predicted[i].Id) { if (Truth[j].Id.Contains(line)) { found = true; break; } } if (found) { orphan = false; aggToTruth[j] += predicted[i].Bordings; break; } } if (orphan) { orphans.Add(new KeyValuePair <string, float>(predicted[i].Id[0], predicted[i].Bordings)); } } for (int i = 0; i < Truth.Length; i++) { var error = aggToTruth[i] - Truth[i].Bordings; rmse += error * error; mabs += Math.Abs(error); terror += error; } var value = Ai.UseComplexErrorFunction ? Ai.ComplexErrorFunction(Parameters, Truth, predicted, aggToTruth) : Ai.ErrorCombinationFunction(rmse, mabs, terror); if (value < BestRunError) { SaveBordingData(aggToTruth, orphans); BestRunError = value; } return(value); }