Changeset 13986
- Timestamp:
- 07/03/16 19:56:55 (8 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame
r13321 r13986 46 46 [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")] 47 47 [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")] 48 [PluginDependency("HeuristicLab.Random", "3.3")] 48 49 public class HeuristicLabProblemsDataAnalysisSymbolicViewsPlugin : PluginBase { 49 50 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
r13941 r13986 317 317 <Private>False</Private> 318 318 </ProjectReference> 319 <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj"> 320 <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project> 321 <Name>HeuristicLab.Random-3.3</Name> 322 </ProjectReference> 319 323 </ItemGroup> 320 324 <ItemGroup /> -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolutionVariableImpactsCalculator.cs
r13985 r13986 30 30 using HeuristicLab.Parameters; 31 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 32 using HeuristicLab.Random; 32 33 33 34 namespace HeuristicLab.Problems.DataAnalysis { … … 37 38 public enum ReplacementMethodEnum { 38 39 Median, 39 Average 40 Average, 41 Shuffle, 42 Noise 40 43 } 41 44 … … 138 141 var originalValues = dataset.GetReadOnlyDoubleValues(variable).ToList(); 139 142 double replacementValue; 143 List<double> replacementValues; 144 IRandom rand; 140 145 141 146 switch (replacement) { 142 147 case ReplacementMethodEnum.Median: 143 148 replacementValue = rows.Select(r => originalValues[r]).Median(); 149 replacementValues = Enumerable.Repeat(replacementValue, dataset.Rows).ToList(); 144 150 break; 145 151 case ReplacementMethodEnum.Average: 146 152 replacementValue = rows.Select(r => originalValues[r]).Average(); 153 replacementValues = Enumerable.Repeat(replacementValue, dataset.Rows).ToList(); 147 154 break; 155 case ReplacementMethodEnum.Shuffle: 156 // new var has same empirical distribution but the relation to y is broken 157 rand = new FastRandom(31415); 158 replacementValues = rows.Select(r => originalValues[r]).Shuffle(rand).ToList(); 159 break; 160 case ReplacementMethodEnum.Noise: 161 var avg = rows.Select(r => originalValues[r]).Average(); 162 var stdDev = rows.Select(r => originalValues[r]).StandardDeviation(); 163 rand = new FastRandom(31415); 164 replacementValues = rows.Select(_ => NormalDistributedRandom.NextDouble(rand, avg, stdDev)).ToList(); 165 break; 166 148 167 default: 149 168 throw new ArgumentException(string.Format("ReplacementMethod {0} cannot be handled.", replacement)); 150 169 } 151 170 152 dataset.ReplaceVariable(variable, Enumerable.Repeat(replacementValue, dataset.Rows).ToList());171 dataset.ReplaceVariable(variable, replacementValues); 153 172 //mkommend: ToList is used on purpose to avoid lazy evaluation that could result in wrong estimates due to variable replacements 154 173 var estimates = model.GetEstimatedValues(dataset, rows).ToList();
Note: See TracChangeset
for help on using the changeset viewer.