Free cookie consent management tool by TermsFeed Policy Generator

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

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

#3040 Added new benchmark and some minor bugfixes.

File size: 3.3 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections;
24using System.Collections.Generic;
25using System.Linq;
26using HeuristicLab.Common;
27using HeuristicLab.Core;
28using HeuristicLab.Problems.DataAnalysis;
29using HeuristicLab.Random;
30using MathNet.Numerics.Statistics;
31using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
32
33namespace HeuristicLab.Problems.Instances.DataAnalysis {
34  public class AzzaliKorns5 : ArtificialRegressionDataDescriptor {
35    public override string Name { get { return "Azzali Korns5 K5 = 3.0 + 2.23 * log(X4)"; } }
36    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."; } }
37
38    protected override string TargetVariable { get { return "K5"; } }
39    protected override string[] VariableNames { get { return AllowedInputVariables.Concat(new[] { TargetVariable }).ToArray(); } }
40    protected override string[] AllowedInputVariables { get { return new string[] { "X1", "X2", "X3", "X4" }; } }
41    protected override int TrainingPartitionStart { get { return 0; } }
42    protected override int TrainingPartitionEnd { get { return 70; } }
43    protected override int TestPartitionStart { get { return 70; } }
44    protected override int TestPartitionEnd { get { return 100; } }
45
46    public int Seed { get; private set; }
47
48    public AzzaliKorns5()
49      : this((int)DateTime.Now.Ticks) { }
50    public AzzaliKorns5(int seed)
51      : base() {
52      Seed = seed;
53    }
54
55
56    protected override List<List<double>> GenerateValues() { return null; }
57    protected override List<IList> GenerateValuesExtended() {
58      var rand = new MersenneTwister((uint)Seed);
59
60      var x1Column = new List<double>(100);
61      var x2Column = new List<double>(100);
62      var x3Column = new List<double>(100);
63      var x4Column = new List<DoubleVector>(100);
64      var k5Column = new List<DoubleVector>(100);
65
66      for (int i = 0; i < 100; i++) {
67        var x1 = rand.NextDouble(-50, +50);
68        var x2 = rand.NextDouble(-50, +50);
69        var x3 = rand.NextDouble(-50, +50);
70        var x4 = rand.NextDoubleVector(-50, +50, 10);
71
72        var k5 = 3 + 2.13 * x4.PointwiseLog();
73
74        x1Column.Add(x1);
75        x2Column.Add(x2);
76        x3Column.Add(x3);
77        x4Column.Add(x4);
78        k5Column.Add(k5);
79      }
80
81      return new List<IList> { x1Column, x2Column, x3Column, x4Column, k5Column };
82    }
83  }
84}
Note: See TracBrowser for help on using the repository browser.