Changeset 17588 for branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression
- Timestamp:
- 06/05/20 14:47:55 (5 years ago)
- Location:
- branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData
- Files:
-
- 5 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliBenchmark3.cs
r17448 r17588 33 33 namespace HeuristicLab.Problems.Instances.DataAnalysis { 34 34 public class AzzaliBenchmark3 : ArtificialRegressionDataDescriptor { 35 public override string Name { get { return "Azzali Benchmark 2B3 = CumMin[3,3] * (X2 / X3) + X4"; } }35 public override string Name { get { return "Azzali Benchmark3 B3 = CumMin[3,3] * (X2 / X3) + X4"; } } 36 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 37 -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/RandomExtensions.cs
r17448 r17588 37 37 return DoubleVector.Build.Dense(values); 38 38 } 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 } 39 48 } 40 49 } -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataInstanceProvider.cs
r17541 r17588 58 58 //new VectorDataTestTwoC(rand.Next()), 59 59 //new VectorDataTestTwoD(rand.Next()), 60 new VectorDataTestThreeA(rand.Next()), 61 new VectorDataTestThreeB(rand.Next()), 62 new VectorDataTestThreeC(rand.Next()), 63 new VectorDataTestThreeD(rand.Next()), 60 64 new AzzaliBenchmark1(rand.Next()), 61 65 new AzzaliBenchmark2(rand.Next()), -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataTestOne.cs
r17541 r17588 27 27 using HeuristicLab.Random; 28 28 using MathNet.Numerics.Statistics; 29 30 29 using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>; 31 30 … … 33 32 public abstract class VectorDataTestOne : ArtificialRegressionDataDescriptor { 34 33 35 protected const int Rows = 100 ;34 protected const int Rows = 1000; 36 35 37 36 public override string Description { get { return ""; } } … … 77 76 int v1Length = vectorLengths[0][i]; 78 77 int v2Length = vectorLengths[1][i]; 79 v1 = rand.NextDoubleVector( -2, 2, v1Length);78 v1 = rand.NextDoubleVector(2, 6, v1Length); 80 79 v2 = rand.NextDoubleVector(3, 5, v2Length); 81 80 -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataTestThree.cs
r17554 r17588 27 27 using HeuristicLab.Random; 28 28 using MathNet.Numerics.Statistics; 29 30 29 using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>; 31 30 32 31 namespace HeuristicLab.Problems.Instances.DataAnalysis { 33 public abstract class VectorDataTestT wo: ArtificialRegressionDataDescriptor {32 public abstract class VectorDataTestThree : ArtificialRegressionDataDescriptor { 34 33 35 34 protected const int Rows = 1000; … … 47 46 public int Seed { get; private set; } 48 47 49 protected VectorDataTestT wo()48 protected VectorDataTestThree() 50 49 : this((int)DateTime.Now.Ticks) { } 51 protected VectorDataTestT wo(int seed)50 protected VectorDataTestThree(int seed) 52 51 : base() { 53 52 Seed = seed; … … 77 76 int v1Length = vectorLengths[0][i]; 78 77 int v2Length = vectorLengths[1][i]; 79 v1 = rand.Next DoubleVector(-2, 2, v1Length);80 v2 = rand.Next DoubleVector(3, 5, v2Length);78 v1 = rand.NextIncreasingDoubleVector(1, 4, v1Length); 79 v2 = rand.NextIncreasingDoubleVector(3, 5, v2Length); 81 80 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(); 83 83 84 84 x1Column.Add(x1); … … 96 96 } 97 97 98 public class VectorDataTestT woA : VectorDataTestTwo{98 public class VectorDataTestThreeA : VectorDataTestThree { 99 99 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)"; } 101 101 } 102 102 103 public VectorDataTestT woA() : base() { }104 public VectorDataTestT woA(int seed) : base(seed) { }103 public VectorDataTestThreeA() : base() { } 104 public VectorDataTestThreeA(int seed) : base(seed) { } 105 105 106 106 protected override List<int>[] GetVectorLengths(IRandom rand) { 107 107 // always same length 108 const int length = 5;108 const int length = 8; 109 109 return new List<int>[2] { 110 110 Enumerable.Repeat(length, Rows).ToList(), … … 114 114 } 115 115 116 public class VectorDataTestT woB : 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)"; } } 118 118 119 public VectorDataTestT woB() : base() { }120 public VectorDataTestT woB(int seed) : base(seed) { }119 public VectorDataTestThreeB() : base() { } 120 public VectorDataTestThreeB(int seed) : base(seed) { } 121 121 122 122 protected override List<int>[] GetVectorLengths(IRandom rand) { 123 // length between length 4 and 8, same row always the same length124 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(); 125 125 return new List<int>[2] { 126 126 Enumerable.Range(0, Rows).Select(i => lengths[i]).ToList(), … … 130 130 } 131 131 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)"; } } 134 134 135 // public VectorDataTestTwoC() : base() { }136 // public VectorDataTestTwoC(int seed) : base(seed) { }135 public VectorDataTestThreeC() : base() { } 136 public VectorDataTestThreeC(int seed) : base(seed) { } 137 137 138 //protected override List<int>[] GetVectorLengths(IRandom rand) {139 // // length between length 4 and 8; each feature is same length140 //// force two different lengths141 // 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 } 152 152 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)"; } } 155 155 156 // public VectorDataTestTwoD() : base() { }157 // public VectorDataTestTwoD(int seed) : base(seed) { }156 public VectorDataTestThreeD() : base() { } 157 public VectorDataTestThreeD(int seed) : base(seed) { } 158 158 159 //protected override List<int>[] GetVectorLengths(IRandom rand) {160 // // always random between 4 and 8161 //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 } 167 167 } -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataTestTwo.cs
r17554 r17588 26 26 using HeuristicLab.Core; 27 27 using HeuristicLab.Random; 28 using MathNet.Numerics.Statistics;29 30 28 using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>; 31 29 … … 73 71 for (int i = 0; i < Rows; i++) { 74 72 x1 = rand.NextDouble(-2, 2); 75 x2 = rand.NextDouble( 2, 6);73 x2 = rand.NextDouble(4, 6); 76 74 x3 = rand.NextDouble(0, 1); 77 75 int v1Length = vectorLengths[0][i]; 78 76 int v2Length = vectorLengths[1][i]; 79 77 v1 = rand.NextDoubleVector(-2, 2, v1Length); 80 v2 = rand.NextDoubleVector( 3, 5, v2Length);78 v2 = rand.NextDoubleVector(2, 4, v2Length); 81 79 82 y = x1 * v1.PointwiseExp().PointwiseMultiply( v2 + x2).Sum();80 y = x1 * v1.PointwiseExp().PointwiseMultiply(x2 - v2 - 2).Sum(); 83 81 84 82 x1Column.Add(x1); … … 98 96 public class VectorDataTestTwoA : VectorDataTestTwo { 99 97 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))"; } 101 99 } 102 100 … … 115 113 116 114 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))"; } } 118 116 119 117 public VectorDataTestTwoB() : base() { } … … 131 129 132 130 //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))"; } } 134 132 135 133 // public VectorDataTestTwoC() : base() { } … … 152 150 153 151 //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))"; } } 155 153 156 154 // public VectorDataTestTwoD() : base() { }
Note: See TracChangeset
for help on using the changeset viewer.