Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/06/19 18:03:15 (6 years ago)
Author:
mkommend
Message:

#2974: First stable version of new CoOp.

Location:
branches/2974_Constants_Optimization/UnitTests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2974_Constants_Optimization/UnitTests/ConstantsOptimizationTests.cs

    r16500 r16507  
    3737
    3838    public static void CompareConstantsOptimizationResults(IRegressionProblemData problemData, ISymbolicExpressionTree tree) {
     39      var applyLinearScaling = true;
    3940      var old_optimizedTree = (ISymbolicExpressionTree)tree.Clone();
    4041      var old_result = SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(
    4142        new SymbolicDataAnalysisExpressionTreeLinearInterpreter(),
    42         old_optimizedTree, problemData, problemData.TrainingIndices, applyLinearScaling: true, maxIterations: 10);
     43        old_optimizedTree, problemData, problemData.TrainingIndices, applyLinearScaling, maxIterations: 10);
    4344
    4445
    4546      var new_optimizedTree = (ISymbolicExpressionTree)tree.Clone();
    46       var new_result = LMConstantsOptimizer.OptimizeConstants(new_optimizedTree, problemData, problemData.TrainingIndices, applyLinearScaling: true, maxIterations: 10);
     47      var new_result = LMConstantsOptimizer.OptimizeConstants(new_optimizedTree, problemData.Dataset, problemData.TargetVariable, problemData.TrainingIndices, applyLinearScaling, maxIterations: 10);
    4748
    4849      //check R² values
     
    5051
    5152      //check numeric values of constants
    52       var old_constants = Util.ExtractConstants(old_optimizedTree);
    53       var new_constants = Util.ExtractConstants(new_optimizedTree);
     53      var old_constants = Util.ExtractConstants(old_optimizedTree, applyLinearScaling);
     54      var new_constants = Util.ExtractConstants(new_optimizedTree, applyLinearScaling);
    5455      //Assert.IsTrue(old_constants.SequenceEqual(new_constants));
    5556
  • branches/2974_Constants_Optimization/UnitTests/PerformanceTest.cs

    r16500 r16507  
    66using HeuristicLab.Problems.DataAnalysis;
    77using HeuristicLab.Problems.DataAnalysis.Symbolic;
     8using HeuristicLab.Problems.DataAnalysis.Symbolic.ConstantsOptimization;
    89using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
    910using HeuristicLab.Problems.Instances.DataAnalysis;
     
    2324    [TestCategory("Problems.DataAnalysis.Symbolic.Regression")]
    2425    [TestProperty("Time", "long")]
    25     public void New_ConstantsOptimization_Tower_Algorithm() {
     26    public static void New_ConstantsOptimization_Tower_Algorithm() {
    2627      var twister = new MersenneTwister((uint)seed);
    2728      var problemData = new RegressionRealWorldInstanceProvider().LoadData(new Tower());
     
    4041      //warm up
    4142      for (int i = 0; i < trees.Length; i++) {
    42         double quality = LMConstantsOptimizer.OptimizeConstants(trees[i], problemData, rows, true, maxIterations);
     43        if (!trees[i].IterateNodesPrefix().OfType<VariableTreeNode>().Any()) Debugger.Break();
     44        double quality = LMConstantsOptimizer.OptimizeConstants(trees[i], problemData.Dataset,problemData.TargetVariable, rows, true, maxIterations);
    4345      }
    4446
     
    4749        watch.Start();
    4850        for (int i = 0; i < trees.Length; i++) {
    49           double quality = LMConstantsOptimizer.OptimizeConstants(trees[i], problemData, rows, true, maxIterations);
     51          double quality = LMConstantsOptimizer.OptimizeConstants(trees[i], problemData.Dataset, problemData.TargetVariable, rows, true, maxIterations);
    5052        }
    5153        watch.Stop();
     
    7678      //warm up
    7779      for (int i = 0; i < trees.Length; i++) {
     80        if (!trees[i].IterateNodesPrefix().OfType<VariableTreeNode>().Any()) Debugger.Break();
    7881        double quality = SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(
    7982          interpreter, trees[i], problemData, rows, true, maxIterations);
  • branches/2974_Constants_Optimization/UnitTests/UnitTests.csproj

    r16461 r16507  
    1111    <RootNamespace>UnitTests</RootNamespace>
    1212    <AssemblyName>UnitTests</AssemblyName>
    13     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     13    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    1414    <FileAlignment>512</FileAlignment>
    1515    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     
    2121    <NuGetPackageImportStamp>
    2222    </NuGetPackageImportStamp>
     23    <TargetFrameworkProfile />
    2324  </PropertyGroup>
    2425  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Note: See TracChangeset for help on using the changeset viewer.