Changeset 14029 for branches/crossvalidation-2434/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelation/FeatureCorrelationView.cs
- Timestamp:
- 07/08/16 14:40:02 (8 years ago)
- Location:
- branches/crossvalidation-2434
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/crossvalidation-2434
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelation/FeatureCorrelationView.cs
r12012 r14029 34 34 35 35 private FeatureCorrelationCache correlationCache; 36 private new FeatureCorrelationCalculator CorrelationCalculator { 37 get { return (FeatureCorrelationCalculator)base.CorrelationCalculator; } 38 set { base.CorrelationCalculator = value; } 39 } 36 40 37 41 public FeatureCorrelationView() 38 42 : base() { 39 43 InitializeComponent(); 44 CorrelationCalculator = new FeatureCorrelationCalculator(); 40 45 correlationCache = new FeatureCorrelationCache(); 41 46 } … … 49 54 } 50 55 56 private void ignoreMissingValuesCheckbox_CheckedChanged(object sender, EventArgs e) { 57 CalculateCorrelation(); 58 } 59 51 60 protected override void CalculateCorrelation() { 52 61 if (correlationCalcComboBox.SelectedItem == null) return; … … 56 65 string partition = (string)partitionComboBox.SelectedValue; 57 66 dataView.Enabled = false; 58 double[,] corr = correlationCache.GetCorrelation(calc, partition );67 double[,] corr = correlationCache.GetCorrelation(calc, partition, ignoreMissingValuesCheckbox.Checked); 59 68 if (corr == null) { 60 fcc.CalculateElements(calc, partition);69 CorrelationCalculator.CalculateElements(Content, calc, partition, ignoreMissingValuesCheckbox.Checked); 61 70 } else { 62 fcc.TryCancelCalculation();71 CorrelationCalculator.TryCancelCalculation(); 63 72 var correlation = new DoubleMatrix(corr, Content.Dataset.DoubleVariables, Content.Dataset.DoubleVariables); 64 73 UpdateDataView(correlation); … … 66 75 } 67 76 68 69 70 protected override void Content_CorrelationCalculationFinished(object sender, FeatureCorrelationCalculator.CorrelationCalculationFinishedArgs e) { 77 protected override void FeatureCorrelation_CalculationFinished(object sender, AbstractFeatureCorrelationCalculator.CorrelationCalculationFinishedArgs e) { 71 78 if (InvokeRequired) { 72 Invoke(new FeatureCorrelationCalculator.CorrelationCalculationFinishedHandler(Content_CorrelationCalculationFinished), sender, e);79 Invoke(new AbstractFeatureCorrelationCalculator.CorrelationCalculationFinishedHandler(FeatureCorrelation_CalculationFinished), sender, e); 73 80 return; 74 81 } 75 correlationCache.SetCorrelation(e.Calculcator, e.Partition, e.Correlation); 82 correlationCache.SetCorrelation(e.Calculcator, e.Partition, e.IgnoreMissingValues, e.Correlation); 83 76 84 var correlation = new DoubleMatrix(e.Correlation, Content.Dataset.DoubleVariables, Content.Dataset.DoubleVariables); 77 85 UpdateDataView(correlation); … … 80 88 [NonDiscoverableType] 81 89 private class FeatureCorrelationCache : Object { 82 private Dictionary<Tuple<IDependencyCalculator, string >, double[,]> correlationsCache;90 private Dictionary<Tuple<IDependencyCalculator, string, bool>, double[,]> correlationsCache; 83 91 84 92 public FeatureCorrelationCache() … … 88 96 89 97 private void InitializeCaches() { 90 correlationsCache = new Dictionary<Tuple<IDependencyCalculator, string >, double[,]>();98 correlationsCache = new Dictionary<Tuple<IDependencyCalculator, string, bool>, double[,]>(); 91 99 } 92 100 … … 95 103 } 96 104 97 public double[,] GetCorrelation(IDependencyCalculator calc, string partition ) {105 public double[,] GetCorrelation(IDependencyCalculator calc, string partition, bool ignoreMissingValues) { 98 106 double[,] corr; 99 var key = new Tuple<IDependencyCalculator, string>(calc, partition);107 var key = Tuple.Create(calc, partition, ignoreMissingValues); 100 108 correlationsCache.TryGetValue(key, out corr); 101 109 return corr; 102 110 } 103 111 104 public void SetCorrelation(IDependencyCalculator calc, string partition, double[,] correlation) {105 var key = new Tuple<IDependencyCalculator, string>(calc, partition);112 public void SetCorrelation(IDependencyCalculator calc, string partition, bool ignoreMissingValues, double[,] correlation) { 113 var key = Tuple.Create(calc, partition, ignoreMissingValues); 106 114 correlationsCache[key] = correlation; 107 115 }
Note: See TracChangeset
for help on using the changeset viewer.