Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17588 for branches


Ignore:
Timestamp:
06/05/20 14:47:55 (4 years ago)
Author:
pfleck
Message:

#3040

  • Adapted existing benchmarks (no mean/sum of vectors with zero-mean).
  • Added new benchmark for testing windowed aggregations.
Location:
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/HeuristicLab.Problems.Instances.DataAnalysis-3.3.csproj

    r17541 r17588  
    262262    <Compile Include="Regression\VectorData\RandomExtensions.cs" />
    263263    <Compile Include="Regression\VectorData\VectorDataInstanceProvider.cs" />
     264    <Compile Include="Regression\VectorData\VectorDataTestThree.cs" />
    264265    <Compile Include="Regression\VectorData\VectorDataTestTwo.cs" />
    265266    <Compile Include="Regression\VectorData\VectorDataTestOne.cs" />
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliBenchmark3.cs

    r17448 r17588  
    3333namespace HeuristicLab.Problems.Instances.DataAnalysis {
    3434  public class AzzaliBenchmark3 : ArtificialRegressionDataDescriptor {
    35     public override string Name { get { return "Azzali Benchmark2 B3 = CumMin[3,3] * (X2 / X3) + X4"; } }
     35    public override string Name { get { return "Azzali Benchmark3 B3 = CumMin[3,3] * (X2 / X3) + X4"; } }
    3636    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."; } }
    3737
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/RandomExtensions.cs

    r17448 r17588  
    3737      return DoubleVector.Build.Dense(values);
    3838    }
     39
     40    public static DoubleVector NextIncreasingDoubleVector(this IRandom rand, double min, double max, int length) {
     41      var values = new double[length];
     42      for (int i = 0; i < values.Length; i++) {
     43        double offset = i * rand.NextDouble();
     44        values[i] = rand.NextDouble(min, max) + offset;
     45      }
     46      return DoubleVector.Build.Dense(values);
     47    }
    3948  }
    4049}
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataInstanceProvider.cs

    r17541 r17588  
    5858        //new VectorDataTestTwoC(rand.Next()),
    5959        //new VectorDataTestTwoD(rand.Next()),
     60        new VectorDataTestThreeA(rand.Next()),
     61        new VectorDataTestThreeB(rand.Next()),
     62        new VectorDataTestThreeC(rand.Next()),
     63        new VectorDataTestThreeD(rand.Next()),
    6064        new AzzaliBenchmark1(rand.Next()),
    6165        new AzzaliBenchmark2(rand.Next()),
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataTestOne.cs

    r17541 r17588  
    2727using HeuristicLab.Random;
    2828using MathNet.Numerics.Statistics;
    29 
    3029using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
    3130
     
    3332  public abstract class VectorDataTestOne : ArtificialRegressionDataDescriptor {
    3433
    35     protected const int Rows = 100;
     34    protected const int Rows = 1000;
    3635
    3736    public override string Description { get { return ""; } }
     
    7776        int v1Length = vectorLengths[0][i];
    7877        int v2Length = vectorLengths[1][i];
    79         v1 = rand.NextDoubleVector(-2, 2, v1Length);
     78        v1 = rand.NextDoubleVector(2, 6, v1Length);
    8079        v2 = rand.NextDoubleVector(3, 5, v2Length);
    8180
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataTestThree.cs

    r17554 r17588  
    2727using HeuristicLab.Random;
    2828using MathNet.Numerics.Statistics;
    29 
    3029using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
    3130
    3231namespace HeuristicLab.Problems.Instances.DataAnalysis {
    33   public abstract class VectorDataTestTwo : ArtificialRegressionDataDescriptor {
     32  public abstract class VectorDataTestThree : ArtificialRegressionDataDescriptor {
    3433
    3534    protected const int Rows = 1000;
     
    4746    public int Seed { get; private set; }
    4847
    49     protected VectorDataTestTwo()
     48    protected VectorDataTestThree()
    5049      : this((int)DateTime.Now.Ticks) { }
    51     protected VectorDataTestTwo(int seed)
     50    protected VectorDataTestThree(int seed)
    5251      : base() {
    5352      Seed = seed;
     
    7776        int v1Length = vectorLengths[0][i];
    7877        int v2Length = vectorLengths[1][i];
    79         v1 = rand.NextDoubleVector(-2, 2, v1Length);
    80         v2 = rand.NextDoubleVector(3, 5, v2Length);
     78        v1 = rand.NextIncreasingDoubleVector(1, 4, v1Length);
     79        v2 = rand.NextIncreasingDoubleVector(3, 5, v2Length);
    8180
    82         y = x1 * v1.PointwiseExp().PointwiseMultiply(v2 + x2).Sum();
     81        //Y = (X1 + sum[2:](V1)) * mean[:-2](V2 + X2)
     82        y = (x1 + v1.SubVector(2, v1.Count - 2).Sum() ) * (v2 + x2).SubVector(0, v2.Count - 2).Mean();
    8383
    8484        x1Column.Add(x1);
     
    9696  }
    9797
    98   public class VectorDataTestTwoA : VectorDataTestTwo {
     98  public class VectorDataTestThreeA : VectorDataTestThree {
    9999    public override string Name {
    100       get { return "Vector Data Test - II [fully-constrained]: Y = X1 * sum(exp(V1) * (V2 + X2))"; }
     100      get { return "Vector Data Test - III [fully-constrained]: Y = (X1 + sum[2:](V1)) * mean[:-2](V2 + X2)"; }
    101101    }
    102102
    103     public VectorDataTestTwoA() : base() { }
    104     public VectorDataTestTwoA(int seed) : base(seed) { }
     103    public VectorDataTestThreeA() : base() { }
     104    public VectorDataTestThreeA(int seed) : base(seed) { }
    105105
    106106    protected override List<int>[] GetVectorLengths(IRandom rand) {
    107107      // always same length
    108       const int length = 5;
     108      const int length = 8;
    109109      return new List<int>[2] {
    110110        Enumerable.Repeat(length, Rows).ToList(),
     
    114114  }
    115115
    116   public class VectorDataTestTwoB : VectorDataTestTwo {
    117     public override string Name { get { return "Vector Data Test - II [row-constrained]: Y = X1 * mean(exp(V1) + X2 * V2)"; } }
     116  public class VectorDataTestThreeB : VectorDataTestThree {
     117    public override string Name { get { return "Vector Data Test - III [row-constrained]: Y = (X1 + sum[2:](V1)) * mean[:-2](V2 + X2)"; } }
    118118
    119     public VectorDataTestTwoB() : base() { }
    120     public VectorDataTestTwoB(int seed) : base(seed) { }
     119    public VectorDataTestThreeB() : base() { }
     120    public VectorDataTestThreeB(int seed) : base(seed) { }
    121121
    122122    protected override List<int>[] GetVectorLengths(IRandom rand) {
    123       // length between length 4 and 8, same row always the same length
    124       var lengths = Enumerable.Range(0, Rows).Select(i => rand.Next(4, 8)).ToList();
     123      // length between length 6 and 10, same row always the same length
     124      var lengths = Enumerable.Range(0, Rows).Select(i => rand.Next(6, 10)).ToList();
    125125      return new List<int>[2] {
    126126        Enumerable.Range(0, Rows).Select(i => lengths[i]).ToList(),
     
    130130  }
    131131
    132   //public class VectorDataTestTwoC : VectorDataTestTwo {
    133   //  public override string Name { get { return "Vector Data Test - II [column-constrained]: Y = X1 * mean(exp(V1) + X2 * V2)"; } }
     132  public class VectorDataTestThreeC : VectorDataTestThree {
     133    public override string Name { get { return "Vector Data Test - III [column-constrained]: Y = (X1 + sum[2:](V1)) * mean[:-2](V2 + X2)"; } }
    134134
    135   //  public VectorDataTestTwoC() : base() { }
    136   //  public VectorDataTestTwoC(int seed) : base(seed) { }
     135    public VectorDataTestThreeC() : base() { }
     136    public VectorDataTestThreeC(int seed) : base(seed) { }
    137137
    138   //  protected override List<int>[] GetVectorLengths(IRandom rand) {
    139   //    // length between length 4 and 8; each feature is same length
    140   //    // force two different lengths
    141   //    int v1Length = rand.Next(4, 8);
    142   //    int v2Length;
    143   //    do {
    144   //      v2Length = rand.Next(4, 8);
    145   //    } while (v1Length != v2Length);
    146   //    return new List<int>[2] {
    147   //      Enumerable.Repeat(v1Length, Rows).ToList(),
    148   //      Enumerable.Repeat(v2Length, Rows).ToList()
    149   //    };
    150   //  }
    151   //}
     138    protected override List<int>[] GetVectorLengths(IRandom rand) {
     139      // length between length 6 and 10; each feature is same length
     140      // force two different lengths
     141      int v1Length = rand.Next(6, 10);
     142      int v2Length;
     143      do {
     144        v2Length = rand.Next(6, 10);
     145      } while (v1Length != v2Length);
     146      return new List<int>[2] {
     147        Enumerable.Repeat(v1Length, Rows).ToList(),
     148        Enumerable.Repeat(v2Length, Rows).ToList()
     149      };
     150    }
     151  }
    152152
    153   //public class VectorDataTestTwoD : VectorDataTestTwo {
    154   //  public override string Name { get { return "Vector Data Test - II [unconstrained]: Y = X1 * mean(exp(V1) + X2 * V2)"; } }
     153  public class VectorDataTestThreeD : VectorDataTestThree {
     154    public override string Name { get { return "Vector Data Test - III [unconstrained]: Y = (X1 + sum[2:](V1)) * mean[:-2](V2 + X2)"; } }
    155155
    156   //  public VectorDataTestTwoD() : base() { }
    157   //  public VectorDataTestTwoD(int seed) : base(seed) { }
     156    public VectorDataTestThreeD() : base() { }
     157    public VectorDataTestThreeD(int seed) : base(seed) { }
    158158
    159   //  protected override List<int>[] GetVectorLengths(IRandom rand) {
    160   //    // always random between 4 and 8
    161   //    return new List<int>[2] {
    162   //        Enumerable.Range(0, Rows).Select(i => rand.Next(4, 8)).ToList(),
    163   //        Enumerable.Range(0, Rows).Select(i => rand.Next(4, 8)).ToList()
    164   //      };
    165   //  }
    166   //}
     159    protected override List<int>[] GetVectorLengths(IRandom rand) {
     160      // always random between 6 and 10
     161      return new List<int>[2] {
     162          Enumerable.Range(0, Rows).Select(i => rand.Next(6, 10)).ToList(),
     163          Enumerable.Range(0, Rows).Select(i => rand.Next(6, 10)).ToList()
     164        };
     165    }
     166  }
    167167}
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataTestTwo.cs

    r17554 r17588  
    2626using HeuristicLab.Core;
    2727using HeuristicLab.Random;
    28 using MathNet.Numerics.Statistics;
    29 
    3028using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
    3129
     
    7371      for (int i = 0; i < Rows; i++) {
    7472        x1 = rand.NextDouble(-2, 2);
    75         x2 = rand.NextDouble(2, 6);
     73        x2 = rand.NextDouble(4, 6);
    7674        x3 = rand.NextDouble(0, 1);
    7775        int v1Length = vectorLengths[0][i];
    7876        int v2Length = vectorLengths[1][i];
    7977        v1 = rand.NextDoubleVector(-2, 2, v1Length);
    80         v2 = rand.NextDoubleVector(3, 5, v2Length);
     78        v2 = rand.NextDoubleVector(2, 4, v2Length);
    8179
    82         y = x1 * v1.PointwiseExp().PointwiseMultiply(v2 + x2).Sum();
     80        y = x1 * v1.PointwiseExp().PointwiseMultiply(x2  - v2 - 2).Sum();
    8381
    8482        x1Column.Add(x1);
     
    9896  public class VectorDataTestTwoA : VectorDataTestTwo {
    9997    public override string Name {
    100       get { return "Vector Data Test - II [fully-constrained]: Y = X1 * sum(exp(V1) * (V2 + X2))"; }
     98      get { return "Vector Data Test - II [fully-constrained]: Y = X1 * sum(exp(V1) * (X2 - V2 - 2))"; }
    10199    }
    102100
     
    115113
    116114  public class VectorDataTestTwoB : VectorDataTestTwo {
    117     public override string Name { get { return "Vector Data Test - II [row-constrained]: Y = X1 * mean(exp(V1) + X2 * V2)"; } }
     115    public override string Name { get { return "Vector Data Test - II [row-constrained]: Y = X1 * sum(exp(V1) * (X2 - V2 - 2))"; } }
    118116
    119117    public VectorDataTestTwoB() : base() { }
     
    131129
    132130  //public class VectorDataTestTwoC : VectorDataTestTwo {
    133   //  public override string Name { get { return "Vector Data Test - II [column-constrained]: Y = X1 * mean(exp(V1) + X2 * V2)"; } }
     131  //  public override string Name { get { return "Vector Data Test - II [column-constrained]: Y = X1 * sum(exp(V1) * (X2 - V2 - 2))"; } }
    134132
    135133  //  public VectorDataTestTwoC() : base() { }
     
    152150
    153151  //public class VectorDataTestTwoD : VectorDataTestTwo {
    154   //  public override string Name { get { return "Vector Data Test - II [unconstrained]: Y = X1 * mean(exp(V1) + X2 * V2)"; } }
     152  //  public override string Name { get { return "Vector Data Test - II [unconstrained]: Y = X1 * sum(exp(V1) * (X2 - V2 - 2))"; } }
    155153
    156154  //  public VectorDataTestTwoD() : base() { }
Note: See TracChangeset for help on using the changeset viewer.