Changeset 16507 for branches/2974_Constants_Optimization/UnitTests
- Timestamp:
- 01/06/19 18:03:15 (6 years ago)
- Location:
- branches/2974_Constants_Optimization/UnitTests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2974_Constants_Optimization/UnitTests/ConstantsOptimizationTests.cs
r16500 r16507 37 37 38 38 public static void CompareConstantsOptimizationResults(IRegressionProblemData problemData, ISymbolicExpressionTree tree) { 39 var applyLinearScaling = true; 39 40 var old_optimizedTree = (ISymbolicExpressionTree)tree.Clone(); 40 41 var old_result = SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants( 41 42 new SymbolicDataAnalysisExpressionTreeLinearInterpreter(), 42 old_optimizedTree, problemData, problemData.TrainingIndices, applyLinearScaling : true, maxIterations: 10);43 old_optimizedTree, problemData, problemData.TrainingIndices, applyLinearScaling, maxIterations: 10); 43 44 44 45 45 46 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); 47 48 48 49 //check R² values … … 50 51 51 52 //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); 54 55 //Assert.IsTrue(old_constants.SequenceEqual(new_constants)); 55 56 -
branches/2974_Constants_Optimization/UnitTests/PerformanceTest.cs
r16500 r16507 6 6 using HeuristicLab.Problems.DataAnalysis; 7 7 using HeuristicLab.Problems.DataAnalysis.Symbolic; 8 using HeuristicLab.Problems.DataAnalysis.Symbolic.ConstantsOptimization; 8 9 using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression; 9 10 using HeuristicLab.Problems.Instances.DataAnalysis; … … 23 24 [TestCategory("Problems.DataAnalysis.Symbolic.Regression")] 24 25 [TestProperty("Time", "long")] 25 public void New_ConstantsOptimization_Tower_Algorithm() {26 public static void New_ConstantsOptimization_Tower_Algorithm() { 26 27 var twister = new MersenneTwister((uint)seed); 27 28 var problemData = new RegressionRealWorldInstanceProvider().LoadData(new Tower()); … … 40 41 //warm up 41 42 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); 43 45 } 44 46 … … 47 49 watch.Start(); 48 50 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); 50 52 } 51 53 watch.Stop(); … … 76 78 //warm up 77 79 for (int i = 0; i < trees.Length; i++) { 80 if (!trees[i].IterateNodesPrefix().OfType<VariableTreeNode>().Any()) Debugger.Break(); 78 81 double quality = SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants( 79 82 interpreter, trees[i], problemData, rows, true, maxIterations); -
branches/2974_Constants_Optimization/UnitTests/UnitTests.csproj
r16461 r16507 11 11 <RootNamespace>UnitTests</RootNamespace> 12 12 <AssemblyName>UnitTests</AssemblyName> 13 <TargetFrameworkVersion>v4. 6.1</TargetFrameworkVersion>13 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> 14 14 <FileAlignment>512</FileAlignment> 15 15 <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> … … 21 21 <NuGetPackageImportStamp> 22 22 </NuGetPackageImportStamp> 23 <TargetFrameworkProfile /> 23 24 </PropertyGroup> 24 25 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Note: See TracChangeset
for help on using the changeset viewer.