Changeset 18027 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs
- Timestamp:
- 07/20/21 18:13:55 (3 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.Tests
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Tests merged: 17940,17943,17948-17950,17958,17965,17968,18001-18002
- Property svn:mergeinfo changed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs
r17180 r18027 274 274 [TestProperty("Time", "long")] 275 275 public void TestCompiledInterpreterEstimatedValuesConsistency() { 276 const double delta = 1e- 12;276 const double delta = 1e-8; 277 277 278 278 var twister = new MersenneTwister(); … … 288 288 grammar.ConfigureAsDefaultRegressionGrammar(); 289 289 grammar.Symbols.First(x => x.Name == "Power Functions").Enabled = true; 290 grammar.Symbols.First(x => x is Cube).Enabled = true; 291 grammar.Symbols.First(x => x is CubeRoot).Enabled = true; 292 grammar.Symbols.First(x => x is Square).Enabled = true; 293 grammar.Symbols.First(x => x is SquareRoot).Enabled = true; 294 grammar.Symbols.First(x => x is Absolute).Enabled = true; 295 grammar.Symbols.First(x => x is Sine).Enabled = true; 296 grammar.Symbols.First(x => x is Cosine).Enabled = true; 297 grammar.Symbols.First(x => x is Tangent).Enabled = true; 298 grammar.Symbols.First(x => x is Root).Enabled = false; 299 grammar.Symbols.First(x => x is Power).Enabled = false; 290 300 291 301 var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 1, 10, 0, 0); … … 311 321 var v2 = valuesMatrix[n][row]; 312 322 if (double.IsNaN(v1) && double.IsNaN(v2)) continue; 313 if ( Math.Abs(v1 - v2) >delta) {323 if (v1 != v2 && Math.Abs(1.0 - v1 / v2) >= delta) { 314 324 Console.WriteLine(formatter.Format(tree)); 315 325 foreach (var node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList()) { … … 339 349 } 340 350 string errorMessage = string.Format("Interpreters {0} and {1} do not agree on tree {2} and row {3} (seed = {4}).", interpreters[m].Name, interpreters[n].Name, i, row, seed); 341 Assert.AreEqual(v1, v2, delta, errorMessage); 351 Assert.IsTrue(double.IsNaN(v1) && double.IsNaN(v2) || 352 v1 == v2 || // in particular 0 = 0 353 Math.Abs(1.0 - v1 / v2) < delta, errorMessage); 342 354 } 343 355 }
Note: See TracChangeset
for help on using the changeset viewer.