Changeset 4948 for branches/DataAnalysis.PopulationDiversityAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers
- Timestamp:
- 11/26/10 21:06:04 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis.PopulationDiversityAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/FineGrainedStructuralPopulationDiversityAnalyzer.cs
r4942 r4948 46 46 // properties: min level delts, max level delta, etc. 47 47 48 #region Properties and Parameters 49 48 50 private const string FunctionTreeGrammarParameterName = "FunctionTreeGrammar"; 49 51 private const string MinimumLevelDeltaParameterName = "MinimumLevelDelta"; 50 52 private const string MaximumLevelDeltaParameterName = "MaximumLevelDelta"; 51 53 private const string PreventMultipleComparisonContributionParameterName = "PreventMultipleComparisonContribution"; 54 private const string MaximumExpressionDepthParameterName = "MaxExpressionDepth"; 55 private const string LevelDifferenceCoefficientParameterName = "LevelDifferenceCoefficient"; 56 private const string AncestorIndexCoefficientParameterName = "AncestorIndexCoefficient"; 57 private const string ConstantValueCoefficientParameterName = "ConstantValueCoefficient"; 58 private const string VariableWeightCoefficientParameterName = "VariableWeightCoefficient"; 59 private const string TimeOffsetCoefficientParameterName = "TimeOffsetCoefficient"; 60 private const string VariableIndexCoefficientParameterName = "VariableIndexCoefficient"; 61 private const string AdditiveSimilarityCalculationParameterName = "AdditiveSimilarityCalculation"; 52 62 53 63 public IValueLookupParameter<GlobalSymbolicExpressionGrammar> FunctionTreeGrammarParameter { … … 57 67 get { return FunctionTreeGrammarParameter.ActualValue; } 58 68 } 69 public IValueLookupParameter<IntValue> MaximumExpressionDepthParameter { 70 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumExpressionDepthParameterName]; } 71 } 72 public int MaximumExpressionDepth { 73 get { return MaximumExpressionDepthParameter.ActualValue.Value; } 74 } 59 75 60 76 public IValueParameter<IntValue> MinimumLevelDeltaParameter { … … 76 92 get { return PreventMultipleComparisonContributionParameter.Value.Value; } 77 93 } 94 95 public IValueParameter<DoubleValue> LevelDifferenceCoefficientParameter { 96 get { return (IValueParameter<DoubleValue>)Parameters[LevelDifferenceCoefficientParameterName]; } 97 } 98 public double LevelDifferenceCoefficient { 99 get { return LevelDifferenceCoefficientParameter.Value.Value; } 100 } 101 public IValueParameter<DoubleValue> AncestorIndexCoefficientParameter { 102 get { return (IValueParameter<DoubleValue>)Parameters[AncestorIndexCoefficientParameterName]; } 103 } 104 public double AncestorIndexCoefficient { 105 get { return AncestorIndexCoefficientParameter.Value.Value; } 106 } 107 public IValueParameter<DoubleValue> ConstantValueCoefficientParameter { 108 get { return (IValueParameter<DoubleValue>)Parameters[ConstantValueCoefficientParameterName]; } 109 } 110 public double ConstantValueCoefficient { 111 get { return ConstantValueCoefficientParameter.Value.Value; } 112 } 113 public IValueParameter<DoubleValue> VariableWeightCoefficientParameter { 114 get { return (IValueParameter<DoubleValue>)Parameters[VariableWeightCoefficientParameterName]; } 115 } 116 public double VariableWeightCoefficient { 117 get { return VariableWeightCoefficientParameter.Value.Value; } 118 } 119 public IValueParameter<DoubleValue> TimeOffsetCoefficientParameter { 120 get { return (IValueParameter<DoubleValue>)Parameters[TimeOffsetCoefficientParameterName]; } 121 } 122 public double TimeOffsetCoefficientCoefficient { 123 get { return TimeOffsetCoefficientParameter.Value.Value; } 124 } 125 public IValueParameter<DoubleValue> VariableIndexCoefficientParameter { 126 get { return (IValueParameter<DoubleValue>)Parameters[VariableIndexCoefficientParameterName]; } 127 } 128 public double VariableIndexCoefficient { 129 get { return VariableIndexCoefficientParameter.Value.Value; } 130 } 131 public IValueParameter<BoolValue> AdditiveSimilarityCalculationParameter { 132 get { return (IValueParameter<BoolValue>)Parameters[AdditiveSimilarityCalculationParameterName]; } 133 } 134 public bool AdditiveSimilarityCalculation { 135 get { return AdditiveSimilarityCalculationParameter.Value.Value; } 136 } 137 138 #endregion 78 139 79 140 [StorableConstructor] … … 82 143 public FineGrainedStructuralPopulationDiversityAnalyzer() : base() { 83 144 Parameters.Add(new ValueLookupParameter<GlobalSymbolicExpressionGrammar>(FunctionTreeGrammarParameterName, "The grammar that is used for symbolic regression models.")); 145 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumExpressionDepthParameterName, "Maximal depth of the analyzed symbolic expressions.")); 84 146 Parameters.Add(new ValueParameter<IntValue>(MinimumLevelDeltaParameterName, "Minimum value for the level delta of the analyzed genetic information items.", new IntValue(0))); 85 147 Parameters.Add(new ValueParameter<IntValue>(MaximumLevelDeltaParameterName, "Maximum value for the level delta of the analyzed genetic information items.", new IntValue(int.MaxValue))); 86 148 Parameters.Add(new ValueParameter<BoolValue>(PreventMultipleComparisonContributionParameterName, "Flag that denotes whether genetic information items are hindered from contributing to the similarity function multiple times.", new BoolValue(false))); 149 Parameters.Add(new ValueParameter<DoubleValue>(LevelDifferenceCoefficientParameterName, "Weighting coefficient for level differences.", new DoubleValue(0.2))); 150 Parameters.Add(new ValueParameter<DoubleValue>(AncestorIndexCoefficientParameterName, "Weighting coefficient for ancestor index differences.", new DoubleValue(0.2))); 151 Parameters.Add(new ValueParameter<DoubleValue>(ConstantValueCoefficientParameterName, "Weighting coefficient for constant value differences.", new DoubleValue(0.2))); 152 Parameters.Add(new ValueParameter<DoubleValue>(VariableWeightCoefficientParameterName, "Weighting coefficient for variable weight differences.", new DoubleValue(0.2))); 153 Parameters.Add(new ValueParameter<DoubleValue>(TimeOffsetCoefficientParameterName, "Weighting coefficient for time lag differences.", new DoubleValue(0.2))); 154 Parameters.Add(new ValueParameter<DoubleValue>(VariableIndexCoefficientParameterName, "Weighting coefficient for variable index differences.", new DoubleValue(0.2))); 155 Parameters.Add(new ValueParameter<BoolValue>(AdditiveSimilarityCalculationParameterName, "Flag that denotes whether the similarity of genetic information items shall be calculated using additive calculation.", new BoolValue(true))); 87 156 } 88 157 … … 135 204 GeneticInformationItem bestPendant = GeneticInformationItem.FindBestPendant(solution1GeneticItems[k], solution2GeneticItems, 136 205 constantMinimumValue, constantMaximumValue, variableWeightSigma, 137 /* TODO: */ 100, 10, 1, 1, 1, 1, 1, 1, true, out bestPendantSimilarity); 206 MaximumExpressionDepth, minimumTimeOffset, maximumTimeOffset, 207 LevelDifferenceCoefficient, AncestorIndexCoefficient, ConstantValueCoefficient, VariableWeightCoefficient, 208 TimeOffsetCoefficientCoefficient, VariableIndexCoefficient, AdditiveSimilarityCalculation, 209 out bestPendantSimilarity); 138 210 if (bestPendant != null) { 139 211 similarity += bestPendantSimilarity; … … 210 282 public static GeneticInformationItem FindBestPendant(GeneticInformationItem Item, IList<GeneticInformationItem> ComparisonItems, 211 283 double ConstantMinimum, double ConstantMaximum, double VariableWeightSigma, 212 int MaximumTreeHeight, int M aximumTimeOffset,284 int MaximumTreeHeight, int MinimumTimeOffset, int MaximumTimeOffset, 213 285 double LevelDifferenceCoefficient, double AncestorIndexCoefficient, 214 286 double ConstantValueCoefficient, double VariableWeightCoefficient, double TimeOffsetCoefficient, double VariableIndexCoefficient, … … 218 290 double similarity, maxSimilarity = -double.MaxValue; 219 291 for (int i = 0; i < ComparisonItems.Count; i++) { 220 similarity = Similarity(Item, ComparisonItems[i], ConstantMinimum, ConstantMaximum, VariableWeightSigma, MaximumTreeHeight, M aximumTimeOffset,292 similarity = Similarity(Item, ComparisonItems[i], ConstantMinimum, ConstantMaximum, VariableWeightSigma, MaximumTreeHeight, MinimumTimeOffset, MaximumTimeOffset, 221 293 LevelDifferenceCoefficient, AncestorIndexCoefficient, ConstantValueCoefficient, VariableWeightSigma, TimeOffsetCoefficient, 222 294 VariableWeightCoefficient, AdditiveSimilarityCalculation); … … 235 307 public static double Similarity(GeneticInformationItem Item1, GeneticInformationItem Item2, 236 308 double ConstantMinimum, double ConstantMaximum, double VariableWeightSigma, 237 int MaximumTreeHeight, int M aximumTimeOffset,309 int MaximumTreeHeight, int MinimumTimeOffset, int MaximumTimeOffset, 238 310 double LevelDifferenceCoefficient, double AncestorIndexCoefficient, 239 311 double ConstantValueCoefficient, double VariableWeightCoefficient, double TimeOffsetCoefficient, double VariableIndexCoefficient, … … 307 379 double timeOffsetDifference = Math.Abs(Item1.DescendantTimeOffset - Item2.DescendantTimeOffset); 308 380 if (MaximumTimeOffset > 0) 309 descendantTimeOffsetDifferencePunishment = timeOffsetDifference / MaximumTimeOffset;381 descendantTimeOffsetDifferencePunishment = timeOffsetDifference / (MaximumTimeOffset - MinimumTimeOffset); 310 382 descendantTimeOffsetDifferencePunishment *= TimeOffsetCoefficient; 311 383 punishmentContributionSum += TimeOffsetCoefficient;
Note: See TracChangeset
for help on using the changeset viewer.