- Timestamp:
- 07/24/12 10:44:47 (12 years ago)
- Location:
- branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis/3.4/Implementation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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.