Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3075_aifeynman_instances/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Feynman/Feynman31.cs @ 17639

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

#3075

  • Added rest of part I equations
  • Set Training/Test Partitions to 105
File size: 1.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using HeuristicLab.Random;
5
6namespace HeuristicLab.Problems.Instances.DataAnalysis {
7  public class Feynman31 : FeynmanDescriptor {
8    public override string Name { get { return "Feynman I.30.5 arcsin(lambd/(n*d))"; } }
9
10    protected override string TargetVariable { get { return "theta"; } }
11    protected override string[] VariableNames { get { return new[] {"lambd", "d", "n", "theta"}; } }
12    protected override string[] AllowedInputVariables { get { return new[] {"lambd", "d", "n"}; } }
13
14    public int Seed { get; private set; }
15
16    public Feynman31() : this((int) DateTime.Now.Ticks) { }
17
18    public Feynman31(int seed) {
19      Seed = seed;
20    }
21
22    protected override List<List<double>> GenerateValues() {
23      var rand = new MersenneTwister((uint) Seed);
24
25      var data  = new List<List<double>>();
26      var lambd = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 2).ToList();
27      var d     = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 2, 5).ToList();
28      var n     = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
29
30      var theta = new List<double>();
31
32      data.Add(lambd);
33      data.Add(d);
34      data.Add(n);
35      data.Add(theta);
36
37      for (var i = 0; i < lambd.Count; i++) {
38        var res = Math.Sinh(lambd[i] / (n[i] * d[i]));
39        theta.Add(res);
40      }
41
42      return data;
43    }
44  }
45}
Note: See TracBrowser for help on using the repository browser.