Changeset 14530 for stable/HeuristicLab.Problems.DataAnalysis
- Timestamp:
- 12/25/16 17:09:04 (8 years ago)
- Location:
- stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 14348,14463
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis merged: 14348,14463
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolutionVariableImpactsCalculator.cs
r14022 r14530 122 122 } 123 123 124 125 124 var impacts = new Dictionary<string, double>(); 126 125 var modifiableDataset = ((Dataset)dataset).ToModifiable(); 127 126 128 foreach (var inputVariable in problemData.AllowedInputVariables) { 127 var inputvariables = new HashSet<string>(problemData.AllowedInputVariables.Union(solution.Model.VariablesUsedForPrediction)); 128 var allowedInputVariables = dataset.VariableNames.Where(v => inputvariables.Contains(v)).ToList(); 129 130 foreach (var inputVariable in allowedInputVariables) { 129 131 var newEstimates = EvaluateModelWithReplacedVariable(solution.Model, inputVariable, modifiableDataset, rows, replacement); 130 132 var newR2 = OnlinePearsonsRCalculator.Calculate(targetValues, newEstimates, out error); … … 156 158 // new var has same empirical distribution but the relation to y is broken 157 159 rand = new FastRandom(31415); 158 replacementValues = rows.Select(r => originalValues[r]).Shuffle(rand).ToList(); 160 // prepare a complete column for the dataset 161 replacementValues = Enumerable.Repeat(double.NaN, dataset.Rows).ToList(); 162 // shuffle only the selected rows 163 var shuffledValues = rows.Select(r => originalValues[r]).Shuffle(rand).ToList(); 164 int i = 0; 165 // update column values 166 foreach (var r in rows) { 167 replacementValues[r] = shuffledValues[i++]; 168 } 159 169 break; 160 170 case ReplacementMethodEnum.Noise: … … 162 172 var stdDev = rows.Select(r => originalValues[r]).StandardDeviation(); 163 173 rand = new FastRandom(31415); 164 replacementValues = rows.Select(_ => NormalDistributedRandom.NextDouble(rand, avg, stdDev)).ToList(); 174 // prepare a complete column for the dataset 175 replacementValues = Enumerable.Repeat(double.NaN, dataset.Rows).ToList(); 176 // update column values 177 foreach (var r in rows) { 178 replacementValues[r] = NormalDistributedRandom.NextDouble(rand, avg, stdDev); 179 } 165 180 break; 166 181
Note: See TracChangeset
for help on using the changeset viewer.