Changeset 17400 for branches/3040_VectorBasedGP
- Timestamp:
- 01/14/20 13:19:04 (5 years ago)
- Location:
- branches/3040_VectorBasedGP
- Files:
-
- 6 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs
r17369 r17400 538 538 case OpCodes.VectorAvg: { 539 539 DoubleVector v = VectorEvaluate(dataset, ref row, state); 540 return v. Average();540 return v.Mean(); 541 541 } 542 542 -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Vectors/DoubleVector.cs
r17367 r17400 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Windows.Markup;26 25 using HEAL.Attic; 27 26 … … 55 54 } 56 55 56 public double DotProduct(DoubleVector other) { 57 return (this * other).Sum(); 58 } 59 57 60 public static DoubleVector operator +(DoubleVector lhs, double rhs) { 58 61 return new DoubleVector(lhs.Select(l => l + rhs)); … … 68 71 } 69 72 73 public static DoubleVector operator +(double lhs, DoubleVector rhs) { 74 return new DoubleVector(rhs.Select(r => lhs + r)); 75 } 76 public static DoubleVector operator -(double lhs, DoubleVector rhs) { 77 return new DoubleVector(rhs.Select(r => lhs - r)); 78 } 79 public static DoubleVector operator *(double lhs, DoubleVector rhs) { 80 return new DoubleVector(rhs.Select(r => lhs * r)); 81 } 82 public static DoubleVector operator /(double lhs, DoubleVector rhs) { 83 return new DoubleVector(rhs.Select(r => lhs / r)); 84 } 85 70 86 public double Sum() { 71 87 return values.Sum(); 72 88 } 73 89 74 public double Average() {90 public double Mean() { 75 91 return values.Average(); 92 } 93 94 public DoubleVector CumulativeMean() { 95 return new DoubleVector( 96 Enumerable.Range(0, this.Count) 97 .Select(this.Take) 98 .Select(numbers => numbers.Average()) 99 ); 76 100 } 77 101 } -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VariousInstanceProvider.cs
r17364 r17400 50 50 var rand = new MersenneTwister((uint)Seed); 51 51 return new List<IDataDescriptor> { 52 new VectorDataTestOne(rand.Next()) 52 new VectorDataTestOne(rand.Next()), 53 new AzzaliKorns5(rand.Next()), 54 new AzzaliBenchmark1(rand.Next()), 55 new AzzaliBenchmark2(rand.Next()), 56 new AzzaliBenchmark3(rand.Next()) 53 57 }; 54 58 } -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataTestOne.cs
r17365 r17400 68 68 69 69 for (int i = 0; i < 100; i++) { 70 x1 = GetRandomDouble(-2, 2, rand);71 x2 = GetRandomDouble(2, 6, rand);72 x3 = GetRandomDouble(0, 1, rand);70 x1 = rand.NextDouble(-2, 2); 71 x2 = rand.NextDouble(2, 6); 72 x3 = rand.NextDouble(0, 1); 73 73 int length = rand.Next(3, 6); 74 v1 = GetRandomDoubleVector(-2, 2, length, rand); 75 v2 = GetRandomDoubleVector(3, 5, length, rand); 76 y = x1 * v1.Sum() + x2 * v2.Average(); 74 v1 = rand.NextDoubleVector(-2, 2, length); 75 v2 = rand.NextDoubleVector(3, 5, length); 76 77 y = x1 * v1.Sum() + x2 * v2.Mean(); 77 78 78 79 x1Column.Add(x1); … … 86 87 return new List<IList> { x1Column, x2Column, x3Column, v1Column, v2Column, yColumn }; 87 88 } 88 89 90 private static double GetRandomDouble(double min, double max, IRandom rand) {91 return (max - min) * rand.NextDouble() + min;92 }93 private static DoubleVector GetRandomDoubleVector(double min, double max, int length, IRandom rand) {94 var values = new double[length];95 for (int i = 0; i < values.Length; i++) {96 values[i] = GetRandomDouble(min, max, rand);97 }98 return new DoubleVector(values);99 }100 89 } 101 90 } -
branches/3040_VectorBasedGP/HeuristicLab.Tests/HeuristicLab.Tests.csproj
r16908 r17400 598 598 <Compile Include="HeuristicLab.Problems.DataAnalysis-3.4\OnlineCalculatorPerformanceTest.cs" /> 599 599 <Compile Include="HeuristicLab.Problems.DataAnalysis-3.4\StatisticCalculatorsTest.cs" /> 600 <Compile Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4\ConstantOptimizationWithVectorsTest.cs" /> 600 601 <Compile Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4\DeriveTest.cs" /> 601 602 <Compile Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4\InfixExpressionParserTest.cs" />
Note: See TracChangeset
for help on using the changeset viewer.