Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Feynman/FeynmanDescriptor.cs @ 18106

Last change on this file since 18106 was 17973, checked in by chaider, 4 years ago

#3075

  • Added target without noise to noisy instances
  • Moved noise calculation to descriptor
File size: 1.2 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using HeuristicLab.Common;
7using HeuristicLab.Core;
8using HeuristicLab.Random;
9
10namespace HeuristicLab.Problems.Instances.DataAnalysis {
11  public abstract class FeynmanDescriptor : ArtificialRegressionDataDescriptor {
12    protected double? noiseRatio;
13    public override string Description {
14      get {
15        return "Feynman instances ... descriptions follows: " + Environment.NewLine;
16      }
17    }
18
19    public List<double> GetNoisyTarget(List<double> target, IRandom rand) {
20      if (noiseRatio == null) return null;
21
22      var targetNoise = new List<double>();
23      var sigmaNoise = Math.Sqrt(noiseRatio.Value) * target.StandardDeviationPop();
24      targetNoise.AddRange(target.Select(md => md + NormalDistributedRandomPolar.NextDouble(rand, 0, sigmaNoise)));
25      return targetNoise;
26
27    }
28
29    protected override int TrainingPartitionStart { get { return 0; } }
30    protected override int TrainingPartitionEnd { get { return 100; } }
31    protected override int TestPartitionStart { get { return 100; } }
32    protected override int TestPartitionEnd { get { return 200; } }
33  }
34}
Note: See TracBrowser for help on using the repository browser.