- Timestamp:
- 07/03/12 16:46:35 (12 years ago)
- Location:
- branches/GP-MoveOperators
- Files:
-
- 1 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-MoveOperators
- Property svn:mergeinfo changed
/trunk/sources merged: 8084,8088-8090,8092-8100,8102-8113,8115,8117-8132,8134-8146,8148-8156,8158-8160,8163-8170,8173-8176,8178-8190,8192-8205
- Property svn:mergeinfo changed
-
branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs
r7734 r8206 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; … … 26 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HeuristicLab.Operators;29 29 using HeuristicLab.Optimization; 30 30 using HeuristicLab.Parameters; 31 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 32 using System;33 32 34 33 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { … … 38 37 [Item("SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer", "An operator that analyzes the Pareto-best symbolic data analysis solution for single objective symbolic data analysis problems.")] 39 38 [StorableClass] 40 public abstract class SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer<T> : SymbolicDataAnalysisSingleObjectiveAnalyzer 41 where T : class, ISymbolicDataAnalysisSolution { 39 public abstract class SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer<S, T> : SymbolicDataAnalysisSingleObjectiveAnalyzer, ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator 40 where T : class, ISymbolicDataAnalysisSolution 41 where S : class, IDataAnalysisProblemData { 42 private const string ProblemDataParameterName = "ProblemData"; 42 43 private const string TrainingBestSolutionsParameterName = "Best training solutions"; 43 44 private const string TrainingBestSolutionQualitiesParameterName = "Best training solution qualities"; 44 45 private const string ComplexityParameterName = "Complexity"; 46 private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter"; 47 private const string EstimationLimitsParameterName = "EstimationLimits"; 45 48 46 49 public override bool EnabledByDefault { … … 58 61 get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters[ComplexityParameterName]; } 59 62 } 63 public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter { 64 get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; } 65 } 66 public ILookupParameter<S> ProblemDataParameter { 67 get { return (ILookupParameter<S>)Parameters[ProblemDataParameterName]; } 68 } 69 public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter { 70 get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; } 71 } 60 72 #endregion 61 73 #region properties … … 72 84 [StorableConstructor] 73 85 protected SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer(bool deserializing) : base(deserializing) { } 74 protected SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer(SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer< T> original, Cloner cloner) : base(original, cloner) { }86 protected SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer(SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer<S, T> original, Cloner cloner) : base(original, cloner) { } 75 87 public SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer() 76 88 : base() { 89 Parameters.Add(new LookupParameter<S>(ProblemDataParameterName, "The problem data for the symbolic data analysis solution.")); 77 90 Parameters.Add(new LookupParameter<ItemList<T>>(TrainingBestSolutionsParameterName, "The training best (Pareto-optimal) symbolic data analysis solutions.")); 78 91 Parameters.Add(new LookupParameter<ItemList<DoubleArray>>(TrainingBestSolutionQualitiesParameterName, "The qualities of the training best (Pareto-optimal) solutions.")); 79 92 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(ComplexityParameterName, "The complexity of each tree.")); 93 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree.")); 94 Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic classification model.")); 80 95 } 81 96 … … 100 115 101 116 List<double> complexities; 102 if (ComplexityParameter.ActualValue != null ) {117 if (ComplexityParameter.ActualValue != null && ComplexityParameter.ActualValue.Length == qualities.Count) { 103 118 complexities = ComplexityParameter.ActualValue.Select(x => x.Value).ToList(); 104 119 } else { -
branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer.cs
r7734 r8206 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; … … 26 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HeuristicLab.Operators;29 29 using HeuristicLab.Optimization; 30 30 using HeuristicLab.Parameters; 31 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 32 using System;33 32 34 33 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { … … 38 37 [Item("SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer", "An operator that analyzes the Pareto-best symbolic data analysis solution for single objective symbolic data analysis problems.")] 39 38 [StorableClass] 40 public abstract class SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer<S, T, U> : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U> 39 public abstract class SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer<S, T, U> : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U>, ISymbolicDataAnalysisBoundedOperator 41 40 where S : class, ISymbolicDataAnalysisSolution 42 41 where T : class, ISymbolicDataAnalysisSingleObjectiveEvaluator<U> … … 45 44 private const string ValidationBestSolutionQualitiesParameterName = "Best validation solution qualities"; 46 45 private const string ComplexityParameterName = "Complexity"; 46 private const string EstimationLimitsParameterName = "EstimationLimits"; 47 47 48 48 public override bool EnabledByDefault { … … 60 60 get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters[ComplexityParameterName]; } 61 61 } 62 public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter { 63 get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; } 64 } 65 62 66 #endregion 63 67 #region properties … … 80 84 Parameters.Add(new LookupParameter<ItemList<DoubleArray>>(ValidationBestSolutionQualitiesParameterName, "The qualities of the validation best (Pareto-optimal) solutions.")); 81 85 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(ComplexityParameterName, "The complexity of each tree.")); 86 Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic classification model.")); 82 87 } 83 88 … … 137 142 138 143 List<double> complexities; 139 if (ComplexityParameter.ActualValue != null ) {144 if (ComplexityParameter.ActualValue != null && ComplexityParameter.ActualValue.Length == trainingQuality.Length) { 140 145 complexities = ComplexityParameter.ActualValue.Select(x => x.Value).ToList(); 141 146 } else { -
branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDepthConstrainedCrossover.cs
r7521 r8206 41 41 42 42 #region Parameter properties 43 public ConstrainedValueParameter<StringValue> DepthRangeParameter {44 get { return ( ConstrainedValueParameter<StringValue>)Parameters[DepthRangeParameterName]; }43 public IConstrainedValueParameter<StringValue> DepthRangeParameter { 44 get { return (IConstrainedValueParameter<StringValue>)Parameters[DepthRangeParameterName]; } 45 45 } 46 46 #endregion … … 89 89 var depthRange = new IntRange(); 90 90 const int depthOffset = 2; // skip the first 2 levels (root + startNode) 91 switch (( int)Enum.Parse(typeof(Ranges), mode)) {92 case (int)Ranges.HighLevel:91 switch ((Ranges)Enum.Parse(typeof(Ranges), mode)) { 92 case Ranges.HighLevel: 93 93 depthRange.Start = depthOffset; // skip the first 2 levels (root + startNode) 94 94 depthRange.End = depthRange.Start + (int)Math.Round(depth * 0.25); 95 95 break; 96 case (int)Ranges.Standard:96 case Ranges.Standard: 97 97 depthRange.Start = depthOffset + (int)Math.Round(depth * 0.25); 98 98 depthRange.End = depthRange.Start + (int)Math.Round(depth * 0.5); 99 99 break; 100 case (int)Ranges.LowLevel:100 case Ranges.LowLevel: 101 101 depthRange.Start = depthOffset + (int)Math.Round(depth * 0.75); 102 102 depthRange.End = Math.Max(depthRange.Start, depth); -
branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMATLABFormatter.cs
r7695 r8206 231 231 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 232 232 stringBuilder.Append(")"); 233 } else if (node.Symbol is AiryA) { 234 stringBuilder.Append("airy("); 235 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 236 stringBuilder.Append(")"); 237 } else if (node.Symbol is AiryB) { 238 stringBuilder.Append("airy(2, "); 239 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 240 stringBuilder.Append(")"); 241 } else if (node.Symbol is Bessel) { 242 stringBuilder.Append("besseli(0.0,"); 243 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 244 stringBuilder.Append(")"); 245 } else if (node.Symbol is CosineIntegral) { 246 stringBuilder.Append("cosint("); 247 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 248 stringBuilder.Append(")"); 249 } else if (node.Symbol is Dawson) { 250 stringBuilder.Append("dawson("); 251 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 252 stringBuilder.Append(")"); 253 } else if (node.Symbol is Erf) { 254 stringBuilder.Append("erf("); 255 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 256 stringBuilder.Append(")"); 257 } else if (node.Symbol is ExponentialIntegralEi) { 258 stringBuilder.Append("expint("); 259 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 260 stringBuilder.Append(")"); 261 } else if (node.Symbol is FresnelCosineIntegral) { 262 stringBuilder.Append("FresnelC("); 263 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 264 stringBuilder.Append(")"); 265 } else if (node.Symbol is FresnelSineIntegral) { 266 stringBuilder.Append("FresnelS("); 267 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 268 stringBuilder.Append(")"); 269 } else if (node.Symbol is Gamma) { 270 stringBuilder.Append("gamma("); 271 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 272 stringBuilder.Append(")"); 273 } else if (node.Symbol is HyperbolicCosineIntegral) { 274 stringBuilder.Append("Chi("); 275 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 276 stringBuilder.Append(")"); 277 } else if (node.Symbol is HyperbolicSineIntegral) { 278 stringBuilder.Append("Shi("); 279 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 280 stringBuilder.Append(")"); 281 } else if (node.Symbol is Norm) { 282 stringBuilder.Append("normpdf("); 283 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 284 stringBuilder.Append(")"); 285 } else if (node.Symbol is Psi) { 286 stringBuilder.Append("psi("); 287 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 288 stringBuilder.Append(")"); 289 } else if (node.Symbol is SineIntegral) { 290 stringBuilder.Append("sinint("); 291 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 292 stringBuilder.Append(")"); 233 293 } else if (symbol is HeuristicLab.Problems.DataAnalysis.Symbolic.Variable) { 234 294 VariableTreeNode variableTreeNode = node as VariableTreeNode; -
branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r8085 r8206 113 113 <ItemGroup> 114 114 <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer.cs" /> 115 <Compile Include="Analyzers\SymbolicDataAnalysisComplexityAnalyzer.cs" />116 115 <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs" /> 117 116 <Compile Include="Analyzers\SymbolicDataAnalysisMultiObjectiveValidationAnalyzer.cs" /> -
branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
r7708 r8206 837 837 public static double Psi(double x) { 838 838 if (double.IsNaN(x)) return double.NaN; 839 else if (x.IsAlmost(0.0)) return double.NaN; 840 else if ((Math.Floor(x) - x).IsAlmost(0.0)) return double.NaN; 839 else if (x <= 0 && (Math.Floor(x) - x).IsAlmost(0)) return double.NaN; 841 840 return alglib.psi(x); 842 841 } … … 865 864 double shi, chi; 866 865 alglib.hyperbolicsinecosineintegrals(x, out shi, out chi); 867 return chi;866 return shi; 868 867 } 869 868 -
branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeInterpreter.cs
r7708 r8206 198 198 { typeof(Norm), OpCodes.Norm}, 199 199 { typeof(Erf), OpCodes.Erf}, 200 { typeof(Bessel), OpCodes.Bessel} 200 { typeof(Bessel), OpCodes.Bessel} 201 201 }; 202 202 … … 370 370 var x = Evaluate(dataset, ref row, state); 371 371 if (double.IsNaN(x)) return double.NaN; 372 else if (x.IsAlmost(0.0)) return double.NaN; 373 else if ((Math.Floor(x) - x).IsAlmost(0)) return double.NaN; 372 else if (x <= 0 && (Math.Floor(x) - x).IsAlmost(0)) return double.NaN; 374 373 return alglib.psi(x); 375 374 } -
branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r8085 r8206 203 203 Operators.Add(new SymbolicExpressionSymbolFrequencyAnalyzer()); 204 204 Operators.Add(new SymbolicDataAnalysisVariableFrequencyAnalyzer()); 205 Operators.Add(new SymbolicDataAnalysisComplexityAnalyzer());206 205 Operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer()); 207 206 Operators.Add(new SymbolicExpressionTreeLengthAnalyzer()); … … 313 312 foreach (var op in operators.OfType<ISymbolicDataAnalysisExpressionCrossover<T>>()) { 314 313 op.EvaluationPartitionParameter.ActualName = FitnessCalculationPartitionParameterName; 315 }316 foreach (var op in operators.OfType<ISymbolicDataAnalysisExpressionCrossover<T>>()) {317 314 op.ProblemDataParameter.ActualName = ProblemDataParameter.Name; 318 315 op.EvaluationPartitionParameter.ActualName = FitnessCalculationPartitionParameter.Name; -
branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableCondition.cs
r8085 r8206 152 152 #region persistence and cloning 153 153 [StorableConstructor] 154 private VariableCondition(bool deserializing) 155 : base(deserializing) { 156 variableNames = new List<string>(); 157 } 154 private VariableCondition(bool deserializing) : base(deserializing) { } 158 155 private VariableCondition(VariableCondition original, Cloner cloner) 159 156 : base(original, cloner) {
Note: See TracChangeset
for help on using the changeset viewer.