Changeset 6415 for branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification
- Timestamp:
- 06/15/11 23:02:01 (14 years ago)
- Location:
- branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationSolution.cs
r6184 r6415 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 23 using System.Linq; … … 66 65 Add(new Result(TrainingAccuracyResultName, "Accuracy of the model on the training partition (percentage of correctly classified instances).", new PercentValue())); 67 66 Add(new Result(TestAccuracyResultName, "Accuracy of the model on the test partition (percentage of correctly classified instances).", new PercentValue())); 68 RecalculateResults();67 CalculateResults(); 69 68 } 70 69 … … 73 72 } 74 73 75 protected override void OnProblemDataChanged(EventArgs e) { 76 base.OnProblemDataChanged(e); 77 RecalculateResults(); 74 protected override void RecalculateResults() { 75 CalculateResults(); 78 76 } 79 77 80 protected override void OnModelChanged(EventArgs e) { 81 base.OnModelChanged(e); 82 RecalculateResults(); 83 } 84 85 protected void RecalculateResults() { 78 private void CalculateResults() { 86 79 double[] estimatedTrainingClassValues = EstimatedTrainingClassValues.ToArray(); // cache values 87 80 IEnumerable<double> originalTrainingClassValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes); -
branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/DiscriminantFunctionClassificationSolution.cs
r5942 r6415 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;28 27 using HeuristicLab.Data; 29 28 using HeuristicLab.Optimization; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 30 31 31 namespace HeuristicLab.Problems.DataAnalysis { … … 89 89 Add(new Result(TrainingRSquaredResultName, "Squared Pearson's correlation coefficient of the model output and the actual values on the training partition", new DoubleValue())); 90 90 Add(new Result(TestRSquaredResultName, "Squared Pearson's correlation coefficient of the model output and the actual values on the test partition", new DoubleValue())); 91 SetAccuracyMaximizingThresholds(); 92 93 //mkommend: important to recalculate accuracy because during the calculation before no thresholds were present 94 base.RecalculateResults(); 95 CalculateResults(); 91 96 RegisterEventHandler(); 92 SetAccuracyMaximizingThresholds();93 RecalculateResults();94 97 } 95 98 … … 99 102 } 100 103 101 protected new void RecalculateResults() { 104 protected override void OnModelChanged(EventArgs e) { 105 DeregisterEventHandler(); 106 SetAccuracyMaximizingThresholds(); 107 RegisterEventHandler(); 108 base.OnModelChanged(e); 109 } 110 111 protected override void RecalculateResults() { 112 base.RecalculateResults(); 113 CalculateResults(); 114 } 115 116 private void CalculateResults() { 102 117 double[] estimatedTrainingValues = EstimatedTrainingValues.ToArray(); // cache values 103 118 IEnumerable<double> originalTrainingValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes); … … 119 134 private void RegisterEventHandler() { 120 135 Model.ThresholdsChanged += new EventHandler(Model_ThresholdsChanged); 136 } 137 private void DeregisterEventHandler() { 138 Model.ThresholdsChanged -= new EventHandler(Model_ThresholdsChanged); 121 139 } 122 140 private void Model_ThresholdsChanged(object sender, EventArgs e) { … … 142 160 } 143 161 144 protected override void OnModelChanged(EventArgs e) {145 base.OnModelChanged(e);146 SetAccuracyMaximizingThresholds();147 RecalculateResults();148 }149 150 protected override void OnProblemDataChanged(EventArgs e) {151 base.OnProblemDataChanged(e);152 SetAccuracyMaximizingThresholds();153 RecalculateResults();154 }155 162 protected virtual void OnModelThresholdsChanged(EventArgs e) { 156 base.OnModelChanged(e);157 163 RecalculateResults(); 158 164 }
Note: See TracChangeset
for help on using the changeset viewer.