- Timestamp:
- 01/25/17 16:37:11 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.OSGAEvaluator/HeuristicLab.OSGAEvaluator/SymbolicRegressionSingleObjectiveOSGAEvaluator.cs
r14585 r14608 231 231 if (UseFixedEvaluationIntervals) { 232 232 double threshold = parentQuality * RelativeParentChildQualityThreshold; 233 233 234 if (UseAdaptiveQualityThreshold) { 234 235 var actualSelectionPressure = ActualSelectionPressureParameter.ActualValue; … … 248 249 if (AggregateStatistics) { 249 250 var trainingEnd = problemData.TrainingPartition.End; 250 var qualityPerInterval = new List<double>(); 251 252 double quality = -1; 253 int intervalCount = 0, rejectionInterval = 0; 254 bool predictedRejected = false; 255 251 256 while (estimatedEnumerator.MoveNext() & targetEnumerator.MoveNext()) { 252 257 var estimated = estimatedEnumerator.Current; 253 258 var target = targetEnumerator.Current; 254 rcalc.Add( estimated, target);259 rcalc.Add(target, estimated); 255 260 ++calculatedRows; 256 261 if (calculatedRows % interval == 0 || calculatedRows == trainingPartitionSize) { 262 intervalCount++; 263 if (predictedRejected) continue; 257 264 var r = rcalc.ErrorState == OnlineCalculatorError.None ? rcalc.R : 0d; 258 qualityPerInterval.Add(r * r); 259 } 260 } 261 double quality; 262 { 263 var r = rcalc.ErrorState != OnlineCalculatorError.None ? 0d : rcalc.R; 264 var actualQuality = r * r; 265 quality = actualQuality; 266 bool predictedRejected = false; 267 268 int i; 269 270 for (i = 0; i < qualityPerInterval.Count; ++i) { 271 var q = qualityPerInterval[i]; 272 if (double.IsNaN(q) || !(q > threshold)) { 265 quality = r * r; 266 if (!(quality > threshold)) { 267 rejectionInterval = intervalCount - 1; 273 268 predictedRejected = true; 274 quality = q;275 break;276 269 } 277 270 } 278 279 var actuallyRejected = !(actualQuality > parentQuality); 280 281 if (RejectedStats.Rows == 0 || TotalStats.Rows == 0) { 282 RejectedStats = new IntMatrix(2, qualityPerInterval.Count + 1); 283 RejectedStats.RowNames = new[] { "Predicted", "Actual" }; 284 RejectedStats.ColumnNames = Enumerable.Range(1, RejectedStats.Columns).Select(x => string.Format("0-{0}", Math.Min(trainingEnd, x * interval))); 285 TotalStats = new IntMatrix(2, 1); 286 TotalStats.RowNames = new[] { "Predicted", "Actual" }; 287 TotalStats.ColumnNames = new[] { "Rejected" }; 288 } 289 290 if (actuallyRejected) { 291 TotalStats[0, 0]++; // prediction true 292 TotalStats[1, 0]++; 293 RejectedStats[0, i]++; 294 RejectedStats[1, i]++; 295 } else { 296 if (predictedRejected) { 297 RejectedStats[0, i]++; 298 TotalStats[0, 0]++; 299 } 271 } 272 var actualQuality = rcalc.ErrorState == OnlineCalculatorError.None ? rcalc.R : 0d; 273 actualQuality *= actualQuality; 274 275 var actuallyRejected = !(actualQuality > parentQuality); 276 277 if (RejectedStats.Rows == 0 || TotalStats.Rows == 0) { 278 RejectedStats = new IntMatrix(2, intervalCount + 1); 279 RejectedStats.RowNames = new[] { "Predicted", "Actual" }; 280 RejectedStats.ColumnNames = Enumerable.Range(1, RejectedStats.Columns).Select(x => string.Format("0-{0}", Math.Min(trainingEnd, x * interval))); 281 TotalStats = new IntMatrix(2, 1); 282 TotalStats.RowNames = new[] { "Predicted", "Actual" }; 283 TotalStats.ColumnNames = new[] { "Rejected" }; 284 } 285 286 if (actuallyRejected) { 287 TotalStats[0, 0]++; // prediction true 288 TotalStats[1, 0]++; 289 RejectedStats[0, rejectionInterval]++; 290 RejectedStats[1, rejectionInterval]++; 291 } else { 292 if (predictedRejected) { 293 RejectedStats[0, rejectionInterval]++; 294 TotalStats[0, 0]++; 300 295 } 301 296 }
Note: See TracChangeset
for help on using the changeset viewer.