Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/24/12 10:44:47 (12 years ago)
Author:
sforsten
Message:

#1292:

  • added cloning method and constructor to ExtendedHeatMap
  • renamed a variable in ExtendedHeatMapView
  • added backwards compatibility code in DataAnalysisProblemData
Location:
branches/DatasetFeatureCorrelation
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis.Views/3.4/CorrelationHeatMapView.Designer.cs

    r8276 r8318  
    2828      this.PartitionLabel = new System.Windows.Forms.Label();
    2929      this.PartitionComboBox = new System.Windows.Forms.ComboBox();
    30       this.ExtendedHeatMap = new HeuristicLab.Problems.DataAnalysis.Views.ExtendedHeatMapView();
     30      this.ExtendedHeatMapView = new HeuristicLab.Problems.DataAnalysis.Views.ExtendedHeatMapView();
    3131      this.HeatMapProgressBar = new System.Windows.Forms.ProgressBar();
    3232      this.SuspendLayout();
     
    7070      // ExtendedHeatMap
    7171      //
    72       this.ExtendedHeatMap.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     72      this.ExtendedHeatMapView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    7373                  | System.Windows.Forms.AnchorStyles.Left)
    7474                  | System.Windows.Forms.AnchorStyles.Right)));
    75       this.ExtendedHeatMap.Caption = "ExtendedHeatMap View";
    76       this.ExtendedHeatMap.Content = null;
    77       this.ExtendedHeatMap.Location = new System.Drawing.Point(3, 30);
    78       this.ExtendedHeatMap.Name = "ExtendedHeatMap";
    79       this.ExtendedHeatMap.ReadOnly = false;
    80       this.ExtendedHeatMap.Size = new System.Drawing.Size(627, 275);
    81       this.ExtendedHeatMap.TabIndex = 4;
     75      this.ExtendedHeatMapView.Caption = "ExtendedHeatMap View";
     76      this.ExtendedHeatMapView.Content = null;
     77      this.ExtendedHeatMapView.Location = new System.Drawing.Point(3, 30);
     78      this.ExtendedHeatMapView.Name = "ExtendedHeatMap";
     79      this.ExtendedHeatMapView.ReadOnly = false;
     80      this.ExtendedHeatMapView.Size = new System.Drawing.Size(627, 275);
     81      this.ExtendedHeatMapView.TabIndex = 4;
    8282      //
    8383      // HeatMapProgressBar
     
    101101      this.Controls.Add(this.CorrelationCalcLabel);
    102102      this.Controls.Add(this.CorrelationCalcComboBox);
    103       this.Controls.Add(this.ExtendedHeatMap);
     103      this.Controls.Add(this.ExtendedHeatMapView);
    104104      this.Name = "CorrelationHeatMapView";
    105105      this.Size = new System.Drawing.Size(633, 308);
     
    115115    protected System.Windows.Forms.Label PartitionLabel;
    116116    protected System.Windows.Forms.ComboBox PartitionComboBox;
    117     protected HeuristicLab.Problems.DataAnalysis.Views.ExtendedHeatMapView ExtendedHeatMap;
     117    protected HeuristicLab.Problems.DataAnalysis.Views.ExtendedHeatMapView ExtendedHeatMapView;
    118118    private System.Windows.Forms.ProgressBar HeatMapProgressBar;
    119119  }
  • branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis.Views/3.4/CorrelationHeatMapView.cs

    r8276 r8318  
    5555    protected override void OnContentChanged() {
    5656      base.OnContentChanged();
    57       ExtendedHeatMap.Content = Content;
     57      ExtendedHeatMapView.Content = Content;
    5858      if (Content != null) {
    5959        CorrelationCalcComboBox.DataSource = Content.CorrelationCalculators;
  • branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs

    r8276 r8318  
    114114    [StorableConstructor]
    115115    protected DataAnalysisProblemData(bool deserializing) : base(deserializing) { }
     116
    116117    [StorableHook(HookType.AfterDeserialization)]
    117118    private void AfterDeserialization() {
     119      // BackwardsCompatibility3.3
     120      #region Backwards compatible code, remove with 3.4
     121      if (!Parameters.ContainsKey(DatasetHeatMapParameterName)) {
     122        Parameters.Add(new FixedValueParameter<ExtendedHeatMap>(DatasetHeatMapParameterName, "", new ExtendedHeatMap()));
     123      }
     124      #endregion
     125      DatasetHeatMap.ProblemData = this;
    118126      RegisterEventHandlers();
    119127    }
  • branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/ExtendedHeatMap.cs

    r8294 r8318  
    2626using System.Linq;
    2727using HeuristicLab.Analysis;
     28using HeuristicLab.Common;
    2829using HeuristicLab.Core;
    2930using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3132
    3233namespace HeuristicLab.Problems.DataAnalysis {
     34  [StorableClass]
    3335  [Item("HeatMap", "Represents a heat map of double values.")]
    34   [StorableClass]
    3536  public class ExtendedHeatMap : HeatMap {
    3637
     38    private const string PrearsonsRSquared = "Pearsons R Squared";
     39    private const string HoeffdingsDependence = "Hoeffdings Dependence";
     40    private const string SpearmansRank = "Spearmans Rank";
     41    public IEnumerable<string> CorrelationCalculators {
     42      get { return new List<string>() { PrearsonsRSquared, HoeffdingsDependence, SpearmansRank }; }
     43    }
     44
     45    private const string AllSamples = "All Samples";
     46    private const string TrainingSamples = "Training Samples";
     47    private const string TestSamples = "Test Samples";
     48    public IEnumerable<string> Partitions {
     49      get { return new List<string>() { AllSamples, TrainingSamples, TestSamples }; }
     50    }
     51
    3752    private IDataAnalysisProblemData problemData;
     53    public IDataAnalysisProblemData ProblemData {
     54      get { return problemData; }
     55      set {
     56        if (problemData != value) {
     57          problemData = value;
     58          columnNames = value.Dataset.DoubleVariables.ToList();
     59          rowNames = value.Dataset.DoubleVariables.ToList();
     60          OnProblemDataChanged();
     61        }
     62      }
     63    }
    3864
    3965    private BackgroundWorker bw;
    40 
    41     public delegate void ProgressCalculationHandler(object sender, ProgressChangedEventArgs e);
    42     public event ProgressCalculationHandler ProgressCalculation;
    4366
    4467    public ExtendedHeatMap()
    4568      : base() {
    46       columnNames = Enumerable.Range(1, 2).Select(x => x.ToString()).ToList();
    47       rowNames = Enumerable.Range(1, 2).Select(x => x.ToString()).ToList();
     69      this.Title = "Feature Correlation";
     70      this.columnNames = Enumerable.Range(1, 2).Select(x => x.ToString()).ToList();
     71      this.rowNames = Enumerable.Range(1, 2).Select(x => x.ToString()).ToList();
    4872    }
    4973
     
    5680      CalculateElements(problemData.Dataset);
    5781    }
    58 
    59     private const string PrearsonsRSquared = "Pearsons R Squared";
    60     private const string HoeffdingsDependence = "Hoeffdings Dependence";
    61     private const string SpearmansRank = "Spearmans Rank";
    62     public IEnumerable<string> CorrelationCalculators {
    63       get { return new List<string>() { PrearsonsRSquared, HoeffdingsDependence, SpearmansRank }; }
    64     }
    65 
    66     private const string AllSamples = "All Samples";
    67     private const string TrainingSamples = "Training Samples";
    68     private const string TestSamples = "Test Samples";
    69     public IEnumerable<string> Partitions {
    70       get { return new List<string>() { AllSamples, TrainingSamples, TestSamples }; }
     82    protected ExtendedHeatMap(ExtendedHeatMap original, Cloner cloner)
     83      : base(original, cloner) {
     84      this.Title = "Feature Correlation";
     85      this.problemData = original.problemData;
     86      this.columnNames = original.problemData.Dataset.DoubleVariables.ToList();
     87      this.rowNames = original.problemData.Dataset.DoubleVariables.ToList();
     88    }
     89    public override IDeepCloneable Clone(Cloner cloner) {
     90      return new ExtendedHeatMap(this, cloner);
    7191    }
    7292
     
    143163    }
    144164
    145     private void bw_ProgressChanged(object sender, ProgressChangedEventArgs e) {
    146       BackgroundWorker worker = sender as BackgroundWorker;
    147       if (!worker.CancellationPending && ProgressCalculation != null) {
    148         ProgressCalculation(sender, e);
    149       }
    150     }
    151 
    152165    private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
    153166      BackgroundWorker worker = sender as BackgroundWorker;
     
    164177    }
    165178
    166     private class BackgroundWorkerInfo {
     179    #region events
     180    public delegate void ProgressCalculationHandler(object sender, ProgressChangedEventArgs e);
     181    public event ProgressCalculationHandler ProgressCalculation;
     182    protected void bw_ProgressChanged(object sender, ProgressChangedEventArgs e) {
     183      BackgroundWorker worker = sender as BackgroundWorker;
     184      if (!worker.CancellationPending && ProgressCalculation != null) {
     185        ProgressCalculation(sender, e);
     186      }
     187    }
     188
     189    public event EventHandler ProblemDataChanged;
     190    protected virtual void OnProblemDataChanged() {
     191      var handler = ProblemDataChanged;
     192      if (handler != null) handler(this, EventArgs.Empty);
     193    }
     194    #endregion
     195
     196    protected class BackgroundWorkerInfo {
    167197      public Dataset Dataset { get; set; }
    168198      public string Calculator { get; set; }
Note: See TracChangeset for help on using the changeset viewer.