Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/07/20 10:47:27 (4 years ago)
Author:
chaider
Message:

#3075 Added noise instances for feynman bonus instances

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3075_aifeynman_instances/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Feynman/FeynmanBonus10.cs

    r17643 r17649  
    22using System.Collections.Generic;
    33using System.Linq;
     4using HeuristicLab.Common;
    45using HeuristicLab.Random;
    56
     
    910    private readonly int trainingSamples;
    1011
    11     public FeynmanBonus10() : this((int) DateTime.Now.Ticks, 10000, 10000) { }
     12    public FeynmanBonus10() : this((int) DateTime.Now.Ticks, 10000, 10000, null) { }
    1213
    1314    public FeynmanBonus10(int seed) {
     
    1516      trainingSamples = 10000;
    1617      testSamples     = 10000;
     18      noiseRatio      = null;
    1719    }
    1820
    19     public FeynmanBonus10(int seed, int trainingSamples, int testSamples) {
     21    public FeynmanBonus10(int seed, int trainingSamples, int testSamples, double? noiseRatio) {
    2022      Seed                 = seed;
    2123      this.trainingSamples = trainingSamples;
    2224      this.testSamples     = testSamples;
     25      this.noiseRatio      = noiseRatio;
    2326    }
    2427
     
    2629      get {
    2730        return string.Format(
    28           "Feynman Relativistic aberation arccos((cos(theta2)-v/c)/(1-v/c*cos(theta2))) | {0} samples",
    29           trainingSamples);
     31          "Feynman Relativistic aberation arccos((cos(theta2)-v/c)/(1-v/c*cos(theta2))) | {0} samples | noise ({1})",
     32          trainingSamples, noiseRatio == null ? "no noise" : noiseRatio.ToString());
    3033      }
    3134    }
    3235
    33     protected override string TargetVariable { get { return "theta1"; } }
    34     protected override string[] VariableNames { get { return new[] {"c", "v", "theta2", "theta1"}; } }
     36    protected override string TargetVariable { get { return noiseRatio == null ? "theta1" : "theta1_noise"; } }
     37
     38    protected override string[] VariableNames {
     39      get { return new[] {"c", "v", "theta2", noiseRatio == null ? "theta1" : "theta1_noise"}; }
     40    }
     41
    3542    protected override string[] AllowedInputVariables { get { return new[] {"c", "v", "theta2"}; } }
    3643
     
    6269      }
    6370
     71      if (noiseRatio != null) {
     72        var theta1_noise = new List<double>();
     73        var sigma_noise  = (double) noiseRatio * theta1.StandardDeviationPop();
     74        theta1_noise.AddRange(theta1.Select(md => md + NormalDistributedRandom.NextDouble(rand, 0, sigma_noise)));
     75        data.Remove(theta1);
     76        data.Add(theta1_noise);
     77      }
     78
    6479      return data;
    6580    }
Note: See TracChangeset for help on using the changeset viewer.