Free cookie consent management tool by TermsFeed Policy Generator

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.
File:
1 copied

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.