Changeset 17400


Ignore:
Timestamp:
01/14/20 13:19:04 (9 months ago)
Author:
pfleck
Message:

#3040 Added Azzali benchmarks

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  
    538538        case OpCodes.VectorAvg: {
    539539            DoubleVector v = VectorEvaluate(dataset, ref row, state);
    540             return v.Average();
     540            return v.Mean();
    541541          }
    542542
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Vectors/DoubleVector.cs

    r17367 r17400  
    2323using System.Collections.Generic;
    2424using System.Linq;
    25 using System.Windows.Markup;
    2625using HEAL.Attic;
    2726
     
    5554    }
    5655
     56    public double DotProduct(DoubleVector other) {
     57      return (this * other).Sum();
     58    }
     59
    5760    public static DoubleVector operator +(DoubleVector lhs, double rhs) {
    5861      return new DoubleVector(lhs.Select(l => l + rhs));
     
    6871    }
    6972
     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
    7086    public double Sum() {
    7187      return values.Sum();
    7288    }
    7389
    74     public double Average() {
     90    public double Mean() {
    7591      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      );
    76100    }
    77101  }
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VariousInstanceProvider.cs

    r17364 r17400  
    5050      var rand = new MersenneTwister((uint)Seed);
    5151      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())
    5357      };
    5458    }
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataTestOne.cs

    r17365 r17400  
    6868
    6969      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);
    7373        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();
    7778
    7879        x1Column.Add(x1);
     
    8687      return new List<IList> { x1Column, x2Column, x3Column, v1Column, v2Column, yColumn };
    8788    }
    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     }
    10089  }
    10190}
  • branches/3040_VectorBasedGP/HeuristicLab.Tests/HeuristicLab.Tests.csproj

    r16908 r17400  
    598598    <Compile Include="HeuristicLab.Problems.DataAnalysis-3.4\OnlineCalculatorPerformanceTest.cs" />
    599599    <Compile Include="HeuristicLab.Problems.DataAnalysis-3.4\StatisticCalculatorsTest.cs" />
     600    <Compile Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4\ConstantOptimizationWithVectorsTest.cs" />
    600601    <Compile Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4\DeriveTest.cs" />
    601602    <Compile Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4\InfixExpressionParserTest.cs" />
Note: See TracChangeset for help on using the changeset viewer.