Changeset 18086 for branches/2521_ProblemRefactoring/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ValueGenerator.cs
- Timestamp:
- 11/19/21 16:07:45 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ValueGenerator.cs
r17226 r18086 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; 25 using HeuristicLab.Common; 26 using HeuristicLab.Core; 24 27 using HeuristicLab.Random; 25 28 … … 97 100 } 98 101 } 102 103 public static List<double> GenerateNoise(IEnumerable<double> target, IRandom rand, double? noiseRatio) { 104 if (noiseRatio == null) return null; 105 106 var targetNoise = new List<double>(); 107 var targetSigma = target.StandardDeviation(); 108 var noisePrng = new NormalDistributedRandomPolar(rand, 0, targetSigma * Math.Sqrt(noiseRatio.Value / (1.0 - noiseRatio.Value))); 109 110 targetNoise.AddRange(target.Select(t => t + noisePrng.NextDouble()).ToList()); 111 return targetNoise; 112 } 99 113 } 100 114 }
Note: See TracChangeset
for help on using the changeset viewer.