Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/08/13 15:36:13 (12 years ago)
Author:
mkommend
Message:

#1837: Updated sliding window GP branch with trunk changes.

Location:
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic
Files:
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic

  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4

    • Property svn:ignore
      •  

        old new  
         1*.user
         2Plugin.cs
        13bin
        2 *.user
        3 HeuristicLabProblemsDataAnalysisSymbolicPlugin.cs
        44obj
        5 *.vs10x
        6 Plugin.cs
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisAlleleFrequencyAnalyzer.cs

    r7305 r9126  
    7070
    7171    protected override Allele[] CalculateAlleles(ISymbolicExpressionTree solution) {
    72       return GetAllSubtreesOfDepth(solution, AlleleTreeDepth)
     72      return CalculateAlleles(solution, AlleleTreeDepth);
     73    }
     74
     75    public static Allele[] CalculateAlleles(ISymbolicExpressionTree solution, int alleleTreedepth) {
     76      return GetAllSubtreesOfDepth(solution, alleleTreedepth)
    7377        .AsParallel()
    74         .Select(t => GetAlleleFromSubtreeOfDepth(t, AlleleTreeDepth))
     78        .Select(t => GetAlleleFromSubtreeOfDepth(t, alleleTreedepth))
    7579        .ToArray();
    7680    }
    7781
    78     private Allele GetAlleleFromSubtreeOfDepth(ISymbolicExpressionTreeNode tree, int d) {
     82    private static Allele GetAlleleFromSubtreeOfDepth(ISymbolicExpressionTreeNode tree, int d) {
    7983      string textualRepresentation = GetTextualRepresentationFromSubtreeOfDepth(tree, d);
    8084      return new Allele(textualRepresentation);
    8185    }
    8286
    83     private string GetTextualRepresentationFromSubtreeOfDepth(ISymbolicExpressionTreeNode tree, int d) {
     87    private static string GetTextualRepresentationFromSubtreeOfDepth(ISymbolicExpressionTreeNode tree, int d) {
    8488      if (d == 0) return "";
    8589      StringBuilder builder = new StringBuilder();
     
    100104    }
    101105
    102     private IEnumerable<ISymbolicExpressionTreeNode> GetAllSubtreesOfDepth(ISymbolicExpressionTree solution, int d) {
     106    private static IEnumerable<ISymbolicExpressionTreeNode> GetAllSubtreesOfDepth(ISymbolicExpressionTree solution, int d) {
    103107      return from node in solution.IterateNodesPostfix()
    104108             where node.GetDepth() >= d
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveAnalyzer.cs

    r7259 r9126  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    23 using System.Linq;
    2422using HeuristicLab.Common;
    2523using HeuristicLab.Core;
    2624using HeuristicLab.Data;
    27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Operators;
    2925using HeuristicLab.Parameters;
    3026using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    31 using HeuristicLab.Optimization;
    3227
    3328namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    3934    private const string QualitiesParameterName = "Qualities";
    4035    private const string MaximizationParameterName = "Maximization";
     36    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    4137    #region parameter properties
    4238    public IScopeTreeLookupParameter<DoubleArray> QualitiesParameter {
     
    4541    public ILookupParameter<BoolArray> MaximizationParameter {
    4642      get { return (ILookupParameter<BoolArray>)Parameters[MaximizationParameterName]; }
     43    }
     44    public ILookupParameter<BoolValue> ApplyLinearScalingParameter {
     45      get { return (ILookupParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
    4746    }
    4847    #endregion
     
    6463      Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>(QualitiesParameterName, "The qualities of the trees that should be analyzed."));
    6564      Parameters.Add(new LookupParameter<BoolArray>(MaximizationParameterName, "The directions of optimization for each dimension."));
     65      Parameters.Add(new LookupParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the individual should be linearly scaled before evaluating."));
     66    }
     67
     68    [StorableHook(HookType.AfterDeserialization)]
     69    private void AfterDeserialization() {
     70      if (Parameters.ContainsKey(ApplyLinearScalingParameterName) && Parameters[ApplyLinearScalingParameterName] is LookupParameter<BoolValue>)
     71        Parameters.Remove(ApplyLinearScalingParameterName);
     72      if (!Parameters.ContainsKey(ApplyLinearScalingParameterName))
     73        Parameters.Add(new LookupParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the individual should be linearly scaled before evaluating."));
    6674    }
    6775  }
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveAnalyzer.cs

    r7259 r9126  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    23 using System.Linq;
    2422using HeuristicLab.Common;
    2523using HeuristicLab.Core;
    2624using HeuristicLab.Data;
    27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Operators;
    2925using HeuristicLab.Parameters;
    3026using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    31 using HeuristicLab.Optimization;
    3227
    3328namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    3934    private const string QualityParameterName = "Quality";
    4035    private const string MaximizationParameterName = "Maximization";
     36    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
     37
    4138    #region parameter properties
    4239    public IScopeTreeLookupParameter<DoubleValue> QualityParameter {
     
    4542    public ILookupParameter<BoolValue> MaximizationParameter {
    4643      get { return (ILookupParameter<BoolValue>)Parameters[MaximizationParameterName]; }
     44    }
     45    public ILookupParameter<BoolValue> ApplyLinearScalingParameter {
     46      get { return (ILookupParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
    4747    }
    4848    #endregion
     
    6464      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(QualityParameterName, "The qualities of the trees that should be analyzed."));
    6565      Parameters.Add(new LookupParameter<BoolValue>(MaximizationParameterName, "The direction of optimization."));
     66      Parameters.Add(new LookupParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the individual should be linearly scaled before evaluating."));
     67    }
     68
     69    [StorableHook(HookType.AfterDeserialization)]
     70    private void AfterDeserialization() {
     71      if (Parameters.ContainsKey(ApplyLinearScalingParameterName) && !(Parameters[ApplyLinearScalingParameterName] is LookupParameter<BoolValue>))
     72        Parameters.Remove(ApplyLinearScalingParameterName);
     73      if (!Parameters.ContainsKey(ApplyLinearScalingParameterName))
     74        Parameters.Add(new LookupParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the individual should be linearly scaled before evaluating."));
    6675    }
    6776  }
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer.cs

    r7259 r9126  
    8585
    8686      var results = ResultCollection;
    87       if (TrainingBestSolutionQuality == null ||
    88         IsBetter(bestQuality, TrainingBestSolutionQuality.Value, Maximization.Value)) {
     87      if (bestTree != null && (TrainingBestSolutionQuality == null ||
     88        IsBetter(bestQuality, TrainingBestSolutionQuality.Value, Maximization.Value))) {
    8989        TrainingBestSolution = CreateSolution(bestTree, bestQuality);
    9090        TrainingBestSolutionQuality = new DoubleValue(bestQuality);
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs

    r7734 r9126  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using System.Linq;
     
    2627using HeuristicLab.Data;
    2728using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Operators;
    2929using HeuristicLab.Optimization;
    3030using HeuristicLab.Parameters;
    3131using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    32 using System;
    3332
    3433namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    3837  [Item("SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer", "An operator that analyzes the Pareto-best symbolic data analysis solution for single objective symbolic data analysis problems.")]
    3938  [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";
    4243    private const string TrainingBestSolutionsParameterName = "Best training solutions";
    4344    private const string TrainingBestSolutionQualitiesParameterName = "Best training solution qualities";
    4445    private const string ComplexityParameterName = "Complexity";
     46    private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter";
     47    private const string EstimationLimitsParameterName = "EstimationLimits";
    4548
    4649    public override bool EnabledByDefault {
     
    5861      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters[ComplexityParameterName]; }
    5962    }
     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    }
    6072    #endregion
    6173    #region properties
     
    7284    [StorableConstructor]
    7385    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) { }
    7587    public SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer()
    7688      : base() {
     89      Parameters.Add(new LookupParameter<S>(ProblemDataParameterName, "The problem data for the symbolic data analysis solution."));
    7790      Parameters.Add(new LookupParameter<ItemList<T>>(TrainingBestSolutionsParameterName, "The training best (Pareto-optimal) symbolic data analysis solutions."));
    7891      Parameters.Add(new LookupParameter<ItemList<DoubleArray>>(TrainingBestSolutionQualitiesParameterName, "The qualities of the training best (Pareto-optimal) solutions."));
    7992      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."));
    8095    }
    8196
     
    100115
    101116      List<double> complexities;
    102       if (ComplexityParameter.ActualValue != null) {
     117      if (ComplexityParameter.ActualValue != null && ComplexityParameter.ActualValue.Length == qualities.Count) {
    103118        complexities = ComplexityParameter.ActualValue.Select(x => x.Value).ToList();
    104119      } else {
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationAnalyzer.cs

    r7721 r9126  
    7676      : base(original, cloner) {
    7777    }
    78     public SymbolicDataAnalysisSingleObjectiveValidationAnalyzer()
    79       : base() {
     78
     79    protected SymbolicDataAnalysisSingleObjectiveValidationAnalyzer(): base() {
    8080      Parameters.Add(new LookupParameter<IRandom>(RandomParameterName, "The random generator."));
    8181      Parameters.Add(new LookupParameter<U>(ProblemDataParameterName, "The problem data of the symbolic data analysis problem."));
    8282      Parameters.Add(new LookupParameter<T>(EvaluatorParameterName, "The operator to use for fitness evaluation on the validation partition."));
    8383      Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The interpreter for symbolic data analysis expression trees."));
    84       Parameters.Add(new ValueLookupParameter<IntRange>(ValidationPartitionParameterName, "Thes validation partition."));
     84      Parameters.Add(new ValueLookupParameter<IntRange>(ValidationPartitionParameterName, "The validation partition."));
    8585      Parameters.Add(new ValueLookupParameter<PercentValue>(RelativeNumberOfEvaluatedSamplesParameterName, "The relative number of samples of the dataset partition, which should be randomly chosen for evaluation between the start and end index."));
    8686      Parameters.Add(new ValueLookupParameter<PercentValue>(PercentageOfBestSolutionsParameterName,
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer.cs

    r7734 r9126  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using System.Linq;
     
    2627using HeuristicLab.Data;
    2728using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Operators;
    2929using HeuristicLab.Optimization;
    3030using HeuristicLab.Parameters;
    3131using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    32 using System;
    3332
    3433namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    3837  [Item("SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer", "An operator that analyzes the Pareto-best symbolic data analysis solution for single objective symbolic data analysis problems.")]
    3938  [StorableClass]
    40   public abstract class SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer<S, T, U> : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U>
     39  public abstract class SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer<S, T, U> : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U>, ISymbolicDataAnalysisBoundedOperator
    4140    where S : class, ISymbolicDataAnalysisSolution
    4241    where T : class, ISymbolicDataAnalysisSingleObjectiveEvaluator<U>
     
    4544    private const string ValidationBestSolutionQualitiesParameterName = "Best validation solution qualities";
    4645    private const string ComplexityParameterName = "Complexity";
     46    private const string EstimationLimitsParameterName = "EstimationLimits";
    4747
    4848    public override bool EnabledByDefault {
     
    6060      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters[ComplexityParameterName]; }
    6161    }
     62    public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter {
     63      get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
     64    }
     65
    6266    #endregion
    6367    #region properties
     
    8084      Parameters.Add(new LookupParameter<ItemList<DoubleArray>>(ValidationBestSolutionQualitiesParameterName, "The qualities of the validation best (Pareto-optimal) solutions."));
    8185      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."));
    8287    }
    8388
     
    137142
    138143      List<double> complexities;
    139       if (ComplexityParameter.ActualValue != null) {
     144      if (ComplexityParameter.ActualValue != null && ComplexityParameter.ActualValue.Length == trainingQuality.Length) {
    140145        complexities = ComplexityParameter.ActualValue.Select(x => x.Value).ToList();
    141146      } else {
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisVariableFrequencyAnalyzer.cs

    r7259 r9126  
    109109      // update variable impacts matrix
    110110      var orderedImpacts = (from row in datatable.Rows
    111                             select new { Name = row.Name, Impact = datatable.Rows[row.Name].Values.Average() })
     111                            select new { Name = row.Name, Impact = Math.Round(datatable.Rows[row.Name].Values.Average(), 3) })
    112112                           .OrderByDescending(p => p.Impact)
    113113                           .ToList();
Note: See TracChangeset for help on using the changeset viewer.