Changeset 12068 for branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
- Timestamp:
- 02/24/15 17:07:41 (10 years ago)
- Location:
- branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r12064 r12068 229 229 Operators.Add(new SymbolicExpressionTreeLengthAnalyzer()); 230 230 Operators.Add(new SymbolicDataAnalysisBottomUpDiversityAnalyzer()); 231 Operators.Add(new SymbolicExpressionTreeBottomUpSimilarityCalculator()); 231 232 ParameterizeOperators(); 232 233 } … … 348 349 op.EvaluatorParameter.ActualName = EvaluatorParameter.Name; 349 350 } 351 foreach (var op in operators.OfType<SymbolicExpressionTreeBottomUpSimilarityCalculator>()) { 352 op.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 353 } 350 354 foreach (var op in operators.OfType<SymbolicDataAnalysisBottomUpDiversityAnalyzer>()) { 351 var sim = op.SimilarityCalculator as SymbolicExpressionTreeBottomUpSimilarityCalculator; 352 if (sim == null) { 353 op.SimilarityCalculator = new SymbolicExpressionTreeBottomUpSimilarityCalculator { 354 SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName 355 }; 356 } else { 357 sim.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 358 } 355 var sim = Operators.OfType<SymbolicExpressionTreeBottomUpSimilarityCalculator>().FirstOrDefault(); 356 if (sim != null) 357 op.SimilarityCalculator = sim; 359 358 } 360 359 } -
branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreePhenotypicSimilarityCalculator.cs
r12064 r12068 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 53 54 54 55 public double CalculateSimilarity(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2) { 56 if (Interpreter == null || ProblemData == null) 57 throw new InvalidOperationException("Cannot calculate phenotypic similarity when no interpreter or problem data were set."); 58 55 59 var v1 = Interpreter.GetSymbolicExpressionTreeValues(t1, ProblemData.Dataset, ProblemData.TrainingIndices); 56 60 var v2 = Interpreter.GetSymbolicExpressionTreeValues(t2, ProblemData.Dataset, ProblemData.TrainingIndices); 61 62 if (v1.Variance().IsAlmost(0) && v2.Variance().IsAlmost(0)) 63 return 1.0; 57 64 58 65 OnlineCalculatorError error; … … 68 75 if (leftSolution == rightSolution) 69 76 return 1.0; 77 78 if (!leftSolution.Variables.ContainsKey("EstimatedValues") || !rightSolution.Variables.ContainsKey("EstimatedValues")) 79 throw new ArgumentException("No estimated values are present in the subscopes."); 70 80 71 81 var leftValues = (DoubleArray)leftSolution.Variables["EstimatedValues"].Value;
Note: See TracChangeset
for help on using the changeset viewer.