Changeset 8318 for branches/DatasetFeatureCorrelation
- Timestamp:
- 07/24/12 10:44:47 (12 years ago)
- Location:
- branches/DatasetFeatureCorrelation
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis.Views/3.4/CorrelationHeatMapView.Designer.cs
r8276 r8318 28 28 this.PartitionLabel = new System.Windows.Forms.Label(); 29 29 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(); 31 31 this.HeatMapProgressBar = new System.Windows.Forms.ProgressBar(); 32 32 this.SuspendLayout(); … … 70 70 // ExtendedHeatMap 71 71 // 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) 73 73 | System.Windows.Forms.AnchorStyles.Left) 74 74 | 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; 82 82 // 83 83 // HeatMapProgressBar … … 101 101 this.Controls.Add(this.CorrelationCalcLabel); 102 102 this.Controls.Add(this.CorrelationCalcComboBox); 103 this.Controls.Add(this.ExtendedHeatMap );103 this.Controls.Add(this.ExtendedHeatMapView); 104 104 this.Name = "CorrelationHeatMapView"; 105 105 this.Size = new System.Drawing.Size(633, 308); … … 115 115 protected System.Windows.Forms.Label PartitionLabel; 116 116 protected System.Windows.Forms.ComboBox PartitionComboBox; 117 protected HeuristicLab.Problems.DataAnalysis.Views.ExtendedHeatMapView ExtendedHeatMap ;117 protected HeuristicLab.Problems.DataAnalysis.Views.ExtendedHeatMapView ExtendedHeatMapView; 118 118 private System.Windows.Forms.ProgressBar HeatMapProgressBar; 119 119 } -
branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis.Views/3.4/CorrelationHeatMapView.cs
r8276 r8318 55 55 protected override void OnContentChanged() { 56 56 base.OnContentChanged(); 57 ExtendedHeatMap .Content = Content;57 ExtendedHeatMapView.Content = Content; 58 58 if (Content != null) { 59 59 CorrelationCalcComboBox.DataSource = Content.CorrelationCalculators; -
branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs
r8276 r8318 114 114 [StorableConstructor] 115 115 protected DataAnalysisProblemData(bool deserializing) : base(deserializing) { } 116 116 117 [StorableHook(HookType.AfterDeserialization)] 117 118 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; 118 126 RegisterEventHandlers(); 119 127 } -
branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/ExtendedHeatMap.cs
r8294 r8318 26 26 using System.Linq; 27 27 using HeuristicLab.Analysis; 28 using HeuristicLab.Common; 28 29 using HeuristicLab.Core; 29 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 31 32 32 33 namespace HeuristicLab.Problems.DataAnalysis { 34 [StorableClass] 33 35 [Item("HeatMap", "Represents a heat map of double values.")] 34 [StorableClass]35 36 public class ExtendedHeatMap : HeatMap { 36 37 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 37 52 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 } 38 64 39 65 private BackgroundWorker bw; 40 41 public delegate void ProgressCalculationHandler(object sender, ProgressChangedEventArgs e);42 public event ProgressCalculationHandler ProgressCalculation;43 66 44 67 public ExtendedHeatMap() 45 68 : 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(); 48 72 } 49 73 … … 56 80 CalculateElements(problemData.Dataset); 57 81 } 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); 71 91 } 72 92 … … 143 163 } 144 164 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 152 165 private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 153 166 BackgroundWorker worker = sender as BackgroundWorker; … … 164 177 } 165 178 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 { 167 197 public Dataset Dataset { get; set; } 168 198 public string Calculator { get; set; }
Note: See TracChangeset
for help on using the changeset viewer.