Changeset 17588 for branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataTestThree.cs
- Timestamp:
- 06/05/20 14:47:55 (4 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.