- Timestamp:
- 05/23/11 16:12:38 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs
r6239 r6254 101 101 102 102 var selectedEnumerators = from pair in estimatedValuesEnumerators 103 where trainingPartitions == null || !trainingPartitions.ContainsKey(pair.Model) || 104 (trainingPartitions[pair.Model].Start <= currentRow && currentRow < trainingPartitions[pair.Model].End) 103 where RowIsTrainingForModel(currentRow, pair.Model) && !RowIsTestForModel(currentRow, pair.Model) 105 104 select pair.EstimatedValuesEnumerator; 106 105 yield return AggregateEstimatedValues(selectedEnumerators.Select(x => x.Current)); … … 121 120 122 121 var selectedEnumerators = from pair in estimatedValuesEnumerators 123 where testPartitions == null || !testPartitions.ContainsKey(pair.Model) || 124 (testPartitions[pair.Model].Start <= currentRow && currentRow < testPartitions[pair.Model].End) 122 where RowIsTestForModel(currentRow, pair.Model) 125 123 select pair.EstimatedValuesEnumerator; 126 124 … … 128 126 } 129 127 } 128 } 129 130 private bool RowIsTrainingForModel(int currentRow, IRegressionModel model) { 131 return trainingPartitions == null || !trainingPartitions.ContainsKey(model) || 132 (trainingPartitions[model].Start <= currentRow && currentRow < trainingPartitions[model].End); 133 } 134 135 private bool RowIsTestForModel(int currentRow, IRegressionModel model) { 136 return testPartitions == null || !testPartitions.ContainsKey(model) || 137 (testPartitions[model].Start <= currentRow && currentRow < testPartitions[model].End); 130 138 } 131 139 … … 148 156 private double AggregateEstimatedValues(IEnumerable<double> estimatedValues) { 149 157 return estimatedValues.DefaultIfEmpty(double.NaN).Average(); 150 } 158 } 151 159 } 152 160 }
Note: See TracChangeset
for help on using the changeset viewer.