Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliBenchmark1.cs @ 17400

Last change on this file since 17400 was 17400, checked in by pfleck, 4 years ago

#3040 Added Azzali benchmarks

File size: 2.4 KB
Line 
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Linq;
5using HeuristicLab.Common;
6using HeuristicLab.Core;
7using HeuristicLab.Problems.DataAnalysis;
8using HeuristicLab.Random;
9
10namespace HeuristicLab.Problems.Instances.DataAnalysis {
11  public class AzzaliBenchmark1 : ArtificialRegressionDataDescriptor {
12    public override string Name { get { return "Azzali Benchmark1 B1 = (X4 + mean(X3)) - ((X3 · X4) - X2)  ( · = dot product)"; } }
13    public override string Description { get { return "I. Azzali, L. Vanneschi, S. Silva, I. Bakurov, and M. Giacobini, “A Vectorial Approach to Genetic Programming,” EuroGP, pp. 213–227, 2019."; } }
14
15    protected override string TargetVariable { get { return "B1"; } }
16    protected override string[] VariableNames { get { return new string[] { "X1", "X2", "X3", "X4" }; } }
17    protected override string[] AllowedInputVariables { get { return new string[] { "X1", "X2", "X3", "X4" }; } }
18    protected override int TrainingPartitionStart { get { return 0; } }
19    protected override int TrainingPartitionEnd { get { return 70; } }
20    protected override int TestPartitionStart { get { return 70; } }
21    protected override int TestPartitionEnd { get { return 100; } }
22
23    public int Seed { get; private set; }
24
25    public AzzaliBenchmark1()
26      : this((int)DateTime.Now.Ticks) { }
27    public AzzaliBenchmark1(int seed)
28      : base() {
29      Seed = seed;
30    }
31
32
33    protected override List<List<double>> GenerateValues() { return null; }
34    protected override List<IList> GenerateValuesExtended() {
35      var rand = new MersenneTwister((uint)Seed);
36
37      var x1Column = new List<double>(100);
38      var x2Column = new List<double>(100);
39      var x3Column = new List<DoubleVector>(100);
40      var x4Column = new List<DoubleVector>(100);
41      var b1Column = new List<DoubleVector>(100);
42
43      for (int i = 0; i < 100; i++) {
44        var x1 = rand.NextDouble(-10, +10);
45        var x2 = rand.NextDouble(-10, +10);
46        var x3 = rand.NextDoubleVector(10, 40, 10);
47        var x4 = rand.NextDoubleVector(-5, +5, 10);
48
49        var b1 = (x4 + x3.Mean()) - (x3.DotProduct(x4) - x2);
50
51        x1Column.Add(x1);
52        x2Column.Add(x2);
53        x3Column.Add(x3);
54        x4Column.Add(x4);
55        b1Column.Add(b1);
56      }
57
58      return new List<IList> { x1Column, x2Column, x3Column, x4Column, b1Column };
59    }
60  }
61}
Note: See TracBrowser for help on using the repository browser.