Changeset 17649 for branches/3075_aifeynman_instances/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Feynman/FeynmanBonus10.cs
- Timestamp:
- 07/07/20 10:47:27 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3075_aifeynman_instances/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Feynman/FeynmanBonus10.cs
r17643 r17649 2 2 using System.Collections.Generic; 3 3 using System.Linq; 4 using HeuristicLab.Common; 4 5 using HeuristicLab.Random; 5 6 … … 9 10 private readonly int trainingSamples; 10 11 11 public FeynmanBonus10() : this((int) DateTime.Now.Ticks, 10000, 10000 ) { }12 public FeynmanBonus10() : this((int) DateTime.Now.Ticks, 10000, 10000, null) { } 12 13 13 14 public FeynmanBonus10(int seed) { … … 15 16 trainingSamples = 10000; 16 17 testSamples = 10000; 18 noiseRatio = null; 17 19 } 18 20 19 public FeynmanBonus10(int seed, int trainingSamples, int testSamples ) {21 public FeynmanBonus10(int seed, int trainingSamples, int testSamples, double? noiseRatio) { 20 22 Seed = seed; 21 23 this.trainingSamples = trainingSamples; 22 24 this.testSamples = testSamples; 25 this.noiseRatio = noiseRatio; 23 26 } 24 27 … … 26 29 get { 27 30 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()); 30 33 } 31 34 } 32 35 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 35 42 protected override string[] AllowedInputVariables { get { return new[] {"c", "v", "theta2"}; } } 36 43 … … 62 69 } 63 70 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 64 79 return data; 65 80 }
Note: See TracChangeset
for help on using the changeset viewer.