- Timestamp:
- 04/03/14 16:21:07 (10 years ago)
- Location:
- branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindowBestSolutionsCollectionHeatMapView.Designer.cs
r10688 r10721 19 19 */ 20 20 #endregion 21 22 using System.Windows.Forms; 21 23 22 24 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { … … 76 78 this.comboBox1.Text = "Pearson R2"; 77 79 this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); 80 this.comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; 78 81 // 79 82 // label1 -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindowBestSolutionsCollectionHeatMapView.cs
r10720 r10721 42 42 base.OnContentChanged(); 43 43 if (Content != null) { 44 // set the dropdown value to the correct value 45 switch (Content.QualityMeasure) { 46 case SlidingWindowBestSolutionsCollection.QualityMeasures.PEARSON: 47 comboBox1.SelectedIndex = comboBox1.Items.IndexOf("Pearson R2"); 48 break; 49 case SlidingWindowBestSolutionsCollection.QualityMeasures.MSE: 50 comboBox1.SelectedIndex = comboBox1.Items.IndexOf("Mean Squared Error"); 51 break; 52 } 44 53 if (Content.SlidingWindowQualities != null) { 45 54 SetHeatmapContent(Content.SlidingWindowQualities); 46 55 } else if (!Content.QualitiesCalculationInProgress) { 47 progress.Start("Calculating best solution qualities...");48 56 Content.CalculateQualities(); 49 57 } … … 64 72 Content.QualitiesCalculationProgress -= bestSolutionCollectionQualitiesCalculationProgress; 65 73 Content.QualitiesUpdated -= bestSolutionCollectionQualitiesUpdated; 74 Content.QualitiesCalculationStarted -= bestSolutionsCollectionQualtiesCalculationStarted; 66 75 base.DeregisterContentEvents(); 67 76 } … … 73 82 Content.QualitiesCalculationProgress += bestSolutionCollectionQualitiesCalculationProgress; 74 83 Content.QualitiesUpdated += bestSolutionCollectionQualitiesUpdated; 84 Content.QualitiesCalculationStarted += bestSolutionsCollectionQualtiesCalculationStarted; 75 85 } 76 86 … … 90 100 private void SetHeatmapContent(double[,] values) { 91 101 double min = 0, max = 0; 92 foreach (var q in values) { 93 if (min > q) min = q; 94 if (max < q) max = q; 102 if (Content.QualityMeasure == SlidingWindowBestSolutionsCollection.QualityMeasures.PEARSON) { 103 max = 1.0; 104 } else { 105 foreach (var q in values) { 106 if (min > q) min = q; 107 if (max < q) max = q; 108 } 95 109 } 96 110 int rows = values.GetLength(0); … … 103 117 } 104 118 heatMapView.Content = new HeatMap(flipped, "Best Sliding Window Solutions", min, max); 119 } 120 121 private void bestSolutionsCollectionQualtiesCalculationStarted(object sender, EventArgs e) { 122 progress.Start("Calculating best solutions qualities..."); 105 123 } 106 124 -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindowBestSolutionsCollectionView.Designer.cs
r10688 r10721 19 19 */ 20 20 #endregion 21 22 using System.Windows.Forms; 21 23 22 24 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { … … 80 82 this.comboBox1.Text = "Pearson R2"; 81 83 this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); 84 this.comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; 82 85 // 83 86 // label1 -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindowBestSolutionsCollectionView.cs
r10720 r10721 43 43 base.OnContentChanged(); 44 44 if (Content != null) { 45 switch (Content.QualityMeasure) { 46 case SlidingWindowBestSolutionsCollection.QualityMeasures.PEARSON: 47 comboBox1.SelectedIndex = comboBox1.Items.IndexOf("Pearson R2"); 48 break; 49 case SlidingWindowBestSolutionsCollection.QualityMeasures.MSE: 50 comboBox1.SelectedIndex = comboBox1.Items.IndexOf("Mean Squared Error"); 51 break; 52 } 45 53 if (Content.SlidingWindowQualities != null) { 46 54 SetMatrixContent(Content.SlidingWindowQualities); 47 55 } else if (!Content.QualitiesCalculationInProgress) { 48 progress.Start("Calculating best solution qualities...");49 56 Content.CalculateQualities(); 50 57 } … … 60 67 Content.QualitiesCalculationProgress -= bestSolutionCollectionQualitiesCalculationProgress; 61 68 Content.QualitiesUpdated -= bestSolutionCollectionQualitiesUpdated; 69 Content.QualitiesCalculationStarted -= bestSolutionsCollectionQualtiesCalculationStarted; 62 70 base.DeregisterContentEvents(); 63 71 } … … 70 78 Content.QualitiesCalculationProgress += bestSolutionCollectionQualitiesCalculationProgress; 71 79 Content.QualitiesUpdated += bestSolutionCollectionQualitiesUpdated; 80 Content.QualitiesCalculationStarted += bestSolutionsCollectionQualtiesCalculationStarted; 72 81 } 73 82 … … 79 88 80 89 #region Event Handlers (Content) 90 private void bestSolutionsCollectionQualtiesCalculationStarted(object sender, EventArgs e) { 91 progress.Start("Calculating best solutions qualities..."); 92 } 93 81 94 private void bestSolutionsCollectionQualitiesCalculated(object sender, RunWorkerCompletedEventArgs e) { 82 95 if (e.Cancelled || e.Error != null) { … … 87 100 SetMatrixContent(Content.SlidingWindowQualities); 88 101 progress.Finish(); 89 }90 91 private void SetMatrixContent(double[,] values) {92 var qualitiesMap = new DoubleMatrix(values); // add an extra columns for the training data93 qualitiesMap.ColumnNames = Enumerable.Range(0, qualitiesMap.Columns - 1).Select(x => Content.SlidingWindowRanges[x].Start + " - " + Content.SlidingWindowRanges[x].End).Concat(new List<string> { "Training" });94 qualitiesMap.RowNames = Enumerable.Range(1, qualitiesMap.Rows).Select(x => "M" + x);95 96 double min = 0, max = 0;97 foreach (var q in qualitiesMap) {98 if (min > q) min = q;99 if (max < q) max = q;100 }101 102 enhancedStringConvertibleMatrixView.Minimum = min;103 enhancedStringConvertibleMatrixView.Maximum = max;104 enhancedStringConvertibleMatrixView.Content = qualitiesMap;105 102 } 106 103 … … 117 114 base.SetEnabledStateOfControls(); 118 115 // TODO: Enable or disable controls based on whether the content is null or the view is set readonly 116 } 117 118 private void SetMatrixContent(double[,] values) { 119 var qualitiesMap = new DoubleMatrix(values); // add an extra columns for the training data 120 qualitiesMap.ColumnNames = Enumerable.Range(0, qualitiesMap.Columns - 1).Select(x => Content.SlidingWindowRanges[x].Start + " - " + Content.SlidingWindowRanges[x].End).Concat(new List<string> { "Training" }); 121 qualitiesMap.RowNames = Enumerable.Range(1, qualitiesMap.Rows).Select(x => "M" + x); 122 double min = 0, max = 0; 123 if (Content.QualityMeasure == SlidingWindowBestSolutionsCollection.QualityMeasures.PEARSON) { 124 max = 1.0; 125 } else { 126 foreach (var q in qualitiesMap) { 127 if (min > q) min = q; 128 if (max < q) max = q; 129 } 130 } 131 132 enhancedStringConvertibleMatrixView.Minimum = min; 133 enhancedStringConvertibleMatrixView.Maximum = max; 134 enhancedStringConvertibleMatrixView.Content = qualitiesMap; 119 135 } 120 136
Note: See TracChangeset
for help on using the changeset viewer.