Free cookie consent management tool by TermsFeed Policy Generator

source: branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape/Analysis/InformationAnalysisCalculator.cs @ 8725

Last change on this file since 8725 was 8725, checked in by epitzer, 12 years ago

improve information analysis #1696

  • fixed a bug in quality delta filtering
  • report finer-grained results
  • add total entropy
  • add peak values to results
File size: 4.6 KB
Line 
1using System.Linq;
2using HeuristicLab.Common;
3using HeuristicLab.Core;
4using HeuristicLab.Data;
5using HeuristicLab.Operators;
6using HeuristicLab.Parameters;
7using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
8
9namespace HeuristicLab.Analysis.FitnessLandscape.Analysis {
10  [Item("InformationAnalysisCalculator", "Performs an information analysis on a quality trail as described in Vassilev et al. (2000) Evol Comput 8:31–60")]
11  [StorableClass]
12  public class InformationAnalysisCalculator : SingleSuccessorOperator {
13
14    #region Parameter Properties
15    public LookupParameter<DataTable> QualityTrailParameter {
16      get { return (LookupParameter<DataTable>)Parameters["QualityTrail"]; }
17    }
18    public ValueLookupParameter<IntValue> NQuantilesParameter {
19      get { return (ValueLookupParameter<IntValue>)Parameters["NQuantiles"]; }
20    }
21    public LookupParameter<DoubleValue> InformationStabilityParameter {
22      get { return (LookupParameter<DoubleValue>)Parameters["InformationStability"]; }
23    }
24    public LookupParameter<IntValue> RegularityParameter {
25      get { return (LookupParameter<IntValue>)Parameters["Regularity"]; }
26    }
27    public LookupParameter<IntValue> DiversityParameter {
28      get { return (LookupParameter<IntValue>)Parameters["Diversity"]; }
29    }
30    public LookupParameter<DoubleArray> InformationContentParameter {
31      get { return (LookupParameter<DoubleArray>)Parameters["InformationContent"]; }
32    }
33    public LookupParameter<DoubleArray> PartialInformationContentParameter {
34      get { return (LookupParameter<DoubleArray>)Parameters["PartialInformationContent"]; }
35    }
36    public LookupParameter<DoubleArray> DensityBasinInformationParameter {
37      get { return (LookupParameter<DoubleArray>)Parameters["DensityBasinInformation"]; }
38    }
39    public LookupParameter<DoubleArray> TotalEntropyParameter {
40      get { return (LookupParameter<DoubleArray>)Parameters["TotalEntropy"]; }
41    }
42    public LookupParameter<DoubleArray> EpsilonQuantilesParameter {
43      get { return (LookupParameter<DoubleArray>)Parameters["EpsilonQuantiles"]; }
44    }
45    #endregion
46
47    #region Constructors & Cloning
48    [StorableConstructor]
49    protected InformationAnalysisCalculator(bool deserializing) : base(deserializing) { }
50    public InformationAnalysisCalculator() {
51      Parameters.Add(new LookupParameter<DataTable>("QualityTrail", "Historical quality trail of a walk over a fitness landscape."));
52      Parameters.Add(new ValueLookupParameter<IntValue>("NQuantiles", "Number of epsilon quantiles to calculate information analysis."));
53      Parameters.Add(new LookupParameter<DoubleValue>("InformationStability"));
54      Parameters.Add(new LookupParameter<IntValue>("Regularity"));
55      Parameters.Add(new LookupParameter<IntValue>("Diversity"));
56      Parameters.Add(new LookupParameter<DoubleArray>("InformationContent"));
57      Parameters.Add(new LookupParameter<DoubleArray>("PartialInformationContent"));
58      Parameters.Add(new LookupParameter<DoubleArray>("DensityBasinInformation"));
59      Parameters.Add(new LookupParameter<DoubleArray>("TotalEntropy"));
60      Parameters.Add(new LookupParameter<DoubleArray>("EpsilonQuantiles", "Considered values of epsilon, selected as quantiles of actual quality differences"));
61    }
62    protected InformationAnalysisCalculator(InformationAnalysisCalculator original, Cloner cloner)
63      : base(original, cloner) {
64    }
65    public override IDeepCloneable Clone(Cloner cloner) {
66      return new InformationAnalysisCalculator(this, cloner);
67    }
68    #endregion
69
70    public override IOperation Apply() {
71      var analysis = new InformationAnalysis(
72        QualityTrailParameter.ActualValue.Rows.First().Values,
73        NQuantilesParameter.ActualValue.Value);
74      RegularityParameter.ActualValue = new IntValue(analysis.Regularity);
75      DiversityParameter.ActualValue = new IntValue(analysis.Diversity);
76      InformationStabilityParameter.ActualValue = new DoubleValue(analysis.InformationStability);
77      InformationContentParameter.ActualValue = new DoubleArray(analysis.InformationContent.ToArray());
78      PartialInformationContentParameter.ActualValue = new DoubleArray(analysis.PartialInformationContent.ToArray());
79      DensityBasinInformationParameter.ActualValue = new DoubleArray(analysis.DensityBasinInformation.ToArray());
80      TotalEntropyParameter.ActualValue = new DoubleArray(analysis.TotalEntropy.ToArray());
81      EpsilonQuantilesParameter.ActualValue = new DoubleArray(analysis.QualityDelta.ToArray());
82      return base.Apply();
83    }
84  }
85}
Note: See TracBrowser for help on using the repository browser.