Changeset 6254
- Timestamp:
- 05/23/11 16:12:38 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleSolution.cs
r6239 r6254 106 106 107 107 var selectedEnumerators = from pair in estimatedValuesEnumerators 108 where trainingPartitions == null || !trainingPartitions.ContainsKey(pair.Model) || 109 (trainingPartitions[pair.Model].Start <= currentRow && currentRow < trainingPartitions[pair.Model].End) 108 where RowIsTrainingForModel(currentRow, pair.Model) && !RowIsTestForModel(currentRow, pair.Model) 110 109 select pair.EstimatedValuesEnumerator; 111 110 yield return AggregateEstimatedClassValues(selectedEnumerators.Select(x => x.Current)); … … 126 125 127 126 var selectedEnumerators = from pair in estimatedValuesEnumerators 128 where testPartitions == null || !testPartitions.ContainsKey(pair.Model) || 129 (testPartitions[pair.Model].Start <= currentRow && currentRow < testPartitions[pair.Model].End) 127 where RowIsTestForModel(currentRow, pair.Model) 130 128 select pair.EstimatedValuesEnumerator; 131 129 … … 133 131 } 134 132 } 133 } 134 135 private bool RowIsTrainingForModel(int currentRow, IClassificationModel model) { 136 return trainingPartitions == null || !trainingPartitions.ContainsKey(model) || 137 (trainingPartitions[model].Start <= currentRow && currentRow < trainingPartitions[model].End); 138 } 139 140 private bool RowIsTestForModel(int currentRow, IClassificationModel model) { 141 return testPartitions == null || !testPartitions.ContainsKey(model) || 142 (testPartitions[model].Start <= currentRow && currentRow < testPartitions[model].End); 135 143 } 136 144 … … 156 164 .OrderBy(g => -g.Count()) 157 165 .Select(g => g.Key) 166 .DefaultIfEmpty(double.NaN) 158 167 .First(); 159 168 } -
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.