Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12086


Ignore:
Timestamp:
02/26/15 15:33:40 (10 years ago)
Author:
bburlacu
Message:

#2326: Moved phenotypic diversity analyzers one level up (since they can be applied to both single- and multiobjective problems). Added wiring in the multiobjective problems. Changed base class to SolutionSimilarityCalculator and adjusted analyzers.

Location:
branches/SymbolicExpressionTreeDiversityAnalyzers
Files:
10 edited
2 moved

Legend:

Unmodified
Added
Removed
  • branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj

    r12029 r12086  
    186186    <Compile Include="ModelCreators\NormalDistributedThresholdsModelCreator.cs" />
    187187    <Compile Include="MultiObjective\SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs" />
    188     <Compile Include="SingleObjective\SymbolicClassificationPhenotypicDiversityAnalyzer.cs" />
     188    <Compile Include="SymbolicClassificationPhenotypicDiversityAnalyzer.cs" />
    189189    <Compile Include="SymbolicClassificationPruningAnalyzer.cs" />
    190190    <Compile Include="SymbolicClassificationSolutionImpactValuesCalculator.cs" />
  • branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs

    r12012 r12086  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Data;
     25using HeuristicLab.Optimization;
    2526using HeuristicLab.Parameters;
    2627using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    105106      Operators.Add(new SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer());
    106107      Operators.Add(new SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer());
     108      Operators.Add(new SymbolicExpressionTreePhenotypicSimilarityCalculator());
     109      Operators.Add(new SymbolicClassificationPhenotypicDiversityAnalyzer(Operators.OfType<SymbolicExpressionTreePhenotypicSimilarityCalculator>()) {
     110        DiversityResultName = "Phenotypic Diversity"
     111      });
    107112      ParameterizeOperators();
    108113    }
     
    135140          op.ModelCreatorParameter.ActualName = ModelCreatorParameter.Name;
    136141      }
     142
     143      foreach (var op in Operators.OfType<ISolutionSimilarityCalculator>()) {
     144        op.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
     145        op.QualityVariableName = Evaluator.QualitiesParameter.ActualName;
     146
     147        if (op is SymbolicExpressionTreePhenotypicSimilarityCalculator) {
     148          var phenotypicSimilarityCalculator = (SymbolicExpressionTreePhenotypicSimilarityCalculator)op;
     149          phenotypicSimilarityCalculator.ProblemData = ProblemData;
     150          phenotypicSimilarityCalculator.Interpreter = SymbolicExpressionTreeInterpreter;
     151        }
     152      }
    137153    }
    138154  }
  • branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs

    r12075 r12086  
    149149      }
    150150
    151       foreach (var op in Operators.OfType<ISingleObjectiveSolutionSimilarityCalculator>()) {
     151      foreach (var op in Operators.OfType<ISolutionSimilarityCalculator>()) {
    152152        op.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    153153        op.QualityVariableName = Evaluator.QualityParameter.ActualName;
  • branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPhenotypicDiversityAnalyzer.cs

    r12079 r12086  
    7676    #endregion
    7777
    78     public SymbolicClassificationPhenotypicDiversityAnalyzer(IEnumerable<ISingleObjectiveSolutionSimilarityCalculator> validSimilarityCalculators)
     78    public SymbolicClassificationPhenotypicDiversityAnalyzer(IEnumerable<ISolutionSimilarityCalculator> validSimilarityCalculators)
    7979      : base(validSimilarityCalculators) {
    8080      #region add parameters
     
    123123        var evaluatedValues = new ItemArray<DoubleArray>(trees.Length);
    124124        for (int i = 0; i < trees.Length; ++i) {
    125           var model =
    126             (IDiscriminantFunctionClassificationModel)
    127               modelCreator.CreateSymbolicDiscriminantFunctionClassificationModel(trees[i], interpreter,
    128                 estimationLimits.Lower, estimationLimits.Upper);
     125          var model = (IDiscriminantFunctionClassificationModel)modelCreator.CreateSymbolicDiscriminantFunctionClassificationModel(trees[i], interpreter, estimationLimits.Lower, estimationLimits.Upper);
    129126          model.RecalculateModelParameters(problemData, rows);
    130127          var values = UseClassValues ? model.GetEstimatedClassValues(ds, rows) : model.GetEstimatedValues(ds, rows);
  • branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj

    r12029 r12086  
    182182    <Compile Include="SingleObjective\ConstantOptimizationAnalyzer.cs" />
    183183    <Compile Include="SingleObjective\Evaluators\SymbolicRegressionMeanRelativeErrorEvaluator.cs" />
    184     <Compile Include="SingleObjective\SymbolicRegressionPhenotypicDiversityAnalyzer.cs" />
     184    <Compile Include="SymbolicRegressionPhenotypicDiversityAnalyzer.cs" />
    185185    <Compile Include="SingleObjective\SymbolicRegressionSolutionsAnalyzer.cs" />
    186186    <Compile Include="SymbolicRegressionPruningAnalyzer.cs" />
  • branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveProblem.cs

    r12012 r12086  
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Data;
     26using HeuristicLab.Optimization;
    2627using HeuristicLab.Parameters;
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    9394      Operators.Add(new SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer());
    9495      Operators.Add(new SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer());
     96      Operators.Add(new SymbolicExpressionTreePhenotypicSimilarityCalculator());
     97      Operators.Add(new SymbolicRegressionPhenotypicDiversityAnalyzer(Operators.OfType<SymbolicExpressionTreePhenotypicSimilarityCalculator>()) {
     98        DiversityResultName = "Phenotypic Diversity"
     99      });
    95100      ParameterizeOperators();
    96101    }
     
    122127        }
    123128      }
     129
     130      foreach (var op in Operators.OfType<ISolutionSimilarityCalculator>()) {
     131        op.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
     132        op.QualityVariableName = Evaluator.QualitiesParameter.ActualName;
     133
     134        if (op is SymbolicExpressionTreePhenotypicSimilarityCalculator) {
     135          var phenotypicSimilarityCalculator = (SymbolicExpressionTreePhenotypicSimilarityCalculator)op;
     136          phenotypicSimilarityCalculator.ProblemData = ProblemData;
     137          phenotypicSimilarityCalculator.Interpreter = SymbolicExpressionTreeInterpreter;
     138        }
     139      }
    124140    }
    125141  }
  • branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs

    r12075 r12086  
    144144      }
    145145
    146       foreach (var op in Operators.OfType<ISingleObjectiveSolutionSimilarityCalculator>()) {
     146      foreach (var op in Operators.OfType<ISolutionSimilarityCalculator>()) {
    147147        op.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    148148        op.QualityVariableName = Evaluator.QualityParameter.ActualName;
  • branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPhenotypicDiversityAnalyzer.cs

    r12079 r12086  
    6161    #endregion
    6262
    63     public SymbolicRegressionPhenotypicDiversityAnalyzer(IEnumerable<ISingleObjectiveSolutionSimilarityCalculator> validSimilarityCalculators)
     63    public SymbolicRegressionPhenotypicDiversityAnalyzer(IEnumerable<ISolutionSimilarityCalculator> validSimilarityCalculators)
    6464      : base(validSimilarityCalculators) {
    6565      #region add parameters
  • branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs

    r12075 r12086  
    4242    }
    4343
    44     public SymbolicDataAnalysisBottomUpDiversityAnalyzer(
    45       IEnumerable<ISingleObjectiveSolutionSimilarityCalculator> validSimilarityCalculators)
     44    public SymbolicDataAnalysisBottomUpDiversityAnalyzer(IEnumerable<ISolutionSimilarityCalculator> validSimilarityCalculators)
    4645      : base(validSimilarityCalculators) {
    4746      UpdateCounterParameter.ActualName = "GenotypicDiversityAnalyzerUpdateCounter";
  • branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs

    r12049 r12086  
    3434  [StorableClass]
    3535  [Item("SymbolicExpressionTreeBottomUpSimilarityCalculator", "A similarity calculator which uses the tree bottom-up distance as a similarity metric.")]
    36   public class SymbolicExpressionTreeBottomUpSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator {
     36  public class SymbolicExpressionTreeBottomUpSimilarityCalculator : SolutionSimilarityCalculator {
    3737    private readonly HashSet<string> commutativeSymbols = new HashSet<string> { "Addition", "Multiplication", "Average", "And", "Or", "Xor" };
    3838    public SymbolicExpressionTreeBottomUpSimilarityCalculator() { }
     39
     40    protected override bool IsCommutative { get { return true; } }
    3941
    4042    [StorableConstructor]
  • branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator.cs

    r12028 r12086  
    3030  [StorableClass]
    3131  [Item("SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator", "A similarity calculator based on the size of the maximum common subtree between two trees")]
    32   public class SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator {
     32  public class SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator : SolutionSimilarityCalculator {
    3333    [Storable]
    3434    private readonly SymbolicExpressionTreeNodeEqualityComparer comparer;
     
    4242      set { comparer.MatchConstantValues = value; }
    4343    }
     44
     45    protected override bool IsCommutative { get { return true; } }
    4446
    4547    [StorableConstructor]
     
    8587    }
    8688
     89
    8790    public static double MaxCommonSubtreeSimilarity(ISymbolicExpressionTree a, ISymbolicExpressionTree b, ISymbolicExpressionTreeNodeSimilarityComparer comparer) {
    8891      int max = 0;
  • branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreePhenotypicSimilarityCalculator.cs

    r12068 r12086  
    3131  [Item("SymbolicExpressionTreePhenotypicSimilarityCalculator", "An operator that calculates the similarity betweeon two trees based on the correlation of their outputs.")]
    3232  [StorableClass]
    33   public class SymbolicExpressionTreePhenotypicSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator {
     33  public class SymbolicExpressionTreePhenotypicSimilarityCalculator : SolutionSimilarityCalculator {
    3434    [Storable]
    3535    public IDataAnalysisProblemData ProblemData { get; set; }
    3636    [Storable]
    3737    public ISymbolicDataAnalysisExpressionTreeInterpreter Interpreter { get; set; }
     38
     39    protected override bool IsCommutative { get { return true; } }
    3840
    3941    [StorableConstructor]
     
    5052    }
    5153
    52     public SymbolicExpressionTreePhenotypicSimilarityCalculator() {
    53     }
     54    public SymbolicExpressionTreePhenotypicSimilarityCalculator() { }
    5455
    5556    public double CalculateSimilarity(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2) {
Note: See TracChangeset for help on using the changeset viewer.