Changeset 8101
- Timestamp:
- 06/25/12 13:11:18 (13 years ago)
- Location:
- branches/ClassificationEnsembleVoting
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.Designer.cs
r7259 r8101 45 45 private void InitializeComponent() { 46 46 this.SamplesComboBox = new System.Windows.Forms.ComboBox(); 47 this.CorrectClassifiedConfidenceLabel = new System.Windows.Forms.Label(); 48 this.CorrectClassifiedConfidence = new System.Windows.Forms.Label(); 49 this.WrongClassifiedConfidenceLabel = new System.Windows.Forms.Label(); 50 this.WrongClassifiedConfidence = new System.Windows.Forms.Label(); 47 51 this.SuspendLayout(); 48 52 // 49 53 // matrixView 50 54 // 51 this.matrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 52 | System.Windows.Forms.AnchorStyles.Left)53 | System.Windows.Forms.AnchorStyles.Right)));55 this.matrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 56 | System.Windows.Forms.AnchorStyles.Left) 57 | System.Windows.Forms.AnchorStyles.Right))); 54 58 this.matrixView.Dock = System.Windows.Forms.DockStyle.None; 55 59 this.matrixView.Location = new System.Drawing.Point(3, 31); 56 this.matrixView.Size = new System.Drawing.Size( 304, 251);60 this.matrixView.Size = new System.Drawing.Size(653, 251); 57 61 // 58 62 // SamplesComboBox 59 63 // 60 this.SamplesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 61 | System.Windows.Forms.AnchorStyles.Right)));64 this.SamplesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 65 | System.Windows.Forms.AnchorStyles.Right))); 62 66 this.SamplesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 63 67 this.SamplesComboBox.FormattingEnabled = true; 64 68 this.SamplesComboBox.Location = new System.Drawing.Point(4, 4); 65 69 this.SamplesComboBox.Name = "SamplesComboBox"; 66 this.SamplesComboBox.Size = new System.Drawing.Size(30 3, 21);70 this.SamplesComboBox.Size = new System.Drawing.Size(309, 21); 67 71 this.SamplesComboBox.TabIndex = 2; 68 72 this.SamplesComboBox.SelectedIndexChanged += new System.EventHandler(this.SamplesComboBox_SelectedIndexChanged); 73 // 74 // CorrectClassifiedConfidenceLabel 75 // 76 this.CorrectClassifiedConfidenceLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 77 this.CorrectClassifiedConfidenceLabel.AutoSize = true; 78 this.CorrectClassifiedConfidenceLabel.Location = new System.Drawing.Point(319, 7); 79 this.CorrectClassifiedConfidenceLabel.Name = "CorrectClassifiedConfidenceLabel"; 80 this.CorrectClassifiedConfidenceLabel.Size = new System.Drawing.Size(103, 13); 81 this.CorrectClassifiedConfidenceLabel.TabIndex = 3; 82 this.CorrectClassifiedConfidenceLabel.Text = "Conf. Correct Class.:"; 83 // 84 // CorrectClassifiedConfidence 85 // 86 this.CorrectClassifiedConfidence.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 87 this.CorrectClassifiedConfidence.AutoSize = true; 88 this.CorrectClassifiedConfidence.Location = new System.Drawing.Point(428, 7); 89 this.CorrectClassifiedConfidence.Name = "CorrectClassifiedConfidence"; 90 this.CorrectClassifiedConfidence.Size = new System.Drawing.Size(22, 13); 91 this.CorrectClassifiedConfidence.TabIndex = 4; 92 this.CorrectClassifiedConfidence.Text = "0.0"; 93 // 94 // WrongClassifiedConfidenceLabel 95 // 96 this.WrongClassifiedConfidenceLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 97 this.WrongClassifiedConfidenceLabel.AutoSize = true; 98 this.WrongClassifiedConfidenceLabel.Location = new System.Drawing.Point(481, 7); 99 this.WrongClassifiedConfidenceLabel.Name = "WrongClassifiedConfidenceLabel"; 100 this.WrongClassifiedConfidenceLabel.Size = new System.Drawing.Size(101, 13); 101 this.WrongClassifiedConfidenceLabel.TabIndex = 5; 102 this.WrongClassifiedConfidenceLabel.Text = "Conf. Wrong Class.:"; 103 // 104 // WrongClassifiedConfidence 105 // 106 this.WrongClassifiedConfidence.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 107 this.WrongClassifiedConfidence.AutoSize = true; 108 this.WrongClassifiedConfidence.Location = new System.Drawing.Point(588, 7); 109 this.WrongClassifiedConfidence.Name = "WrongClassifiedConfidence"; 110 this.WrongClassifiedConfidence.Size = new System.Drawing.Size(22, 13); 111 this.WrongClassifiedConfidence.TabIndex = 6; 112 this.WrongClassifiedConfidence.Text = "0.0"; 69 113 // 70 114 // ClassificationEnsembleSolutionEstimatedClassValuesView … … 72 116 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 73 117 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 118 this.Controls.Add(this.WrongClassifiedConfidence); 119 this.Controls.Add(this.WrongClassifiedConfidenceLabel); 120 this.Controls.Add(this.CorrectClassifiedConfidence); 121 this.Controls.Add(this.CorrectClassifiedConfidenceLabel); 74 122 this.Controls.Add(this.SamplesComboBox); 75 123 this.Name = "ClassificationEnsembleSolutionEstimatedClassValuesView"; 124 this.Size = new System.Drawing.Size(659, 285); 76 125 this.Controls.SetChildIndex(this.matrixView, 0); 77 126 this.Controls.SetChildIndex(this.SamplesComboBox, 0); 127 this.Controls.SetChildIndex(this.CorrectClassifiedConfidenceLabel, 0); 128 this.Controls.SetChildIndex(this.CorrectClassifiedConfidence, 0); 129 this.Controls.SetChildIndex(this.WrongClassifiedConfidenceLabel, 0); 130 this.Controls.SetChildIndex(this.WrongClassifiedConfidence, 0); 78 131 this.ResumeLayout(false); 132 this.PerformLayout(); 79 133 80 134 } … … 83 137 84 138 private System.Windows.Forms.ComboBox SamplesComboBox; 139 private System.Windows.Forms.Label CorrectClassifiedConfidenceLabel; 140 private System.Windows.Forms.Label CorrectClassifiedConfidence; 141 private System.Windows.Forms.Label WrongClassifiedConfidenceLabel; 142 private System.Windows.Forms.Label WrongClassifiedConfidence; 85 143 86 144 } -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs
r7866 r8101 105 105 IClassificationEnsembleSolutionWeightCalculator weightCalc = Content.WeightCalculator; 106 106 107 // needed to calculate average confidences of correct and wrong estimated classes 108 bool correctClassified; 109 double[] confidence = new double[2]; 110 int[] classified = new int[2]; 111 double curConfidence; 112 107 113 for (int i = 0; i < indizes.Length; i++) { 108 114 int row = indizes[i]; … … 112 118 if (solutionsCount > 0) { 113 119 values[i, 2] = estimatedClassValues[i].ToString(); 114 values[i, 3] = (target[i].IsAlmost(estimatedClassValues[i])).ToString(); 115 values[i, 4] = weightCalc.GetConfidence(solutions, indizes[i], estimatedClassValues[i]).ToString(); 120 correctClassified = target[i].IsAlmost(estimatedClassValues[i]); 121 values[i, 3] = correctClassified.ToString(); 122 curConfidence = weightCalc.GetConfidence(solutions, indizes[i], estimatedClassValues[i]); 123 if (correctClassified) { 124 confidence[0] += curConfidence; 125 classified[0]++; 126 } else { 127 confidence[1] += curConfidence; 128 classified[1]++; 129 } 130 131 values[i, 4] = curConfidence.ToString(); 116 132 117 133 var groups = … … 129 145 } 130 146 } 147 148 CorrectClassifiedConfidence.Text = (confidence[0] / (double)classified[0]).ToString(); 149 WrongClassifiedConfidence.Text = (confidence[1] / (double)classified[1]).ToString(); 131 150 132 151 StringMatrix matrix = new StringMatrix(values); -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
r7866 r8101 149 149 <Compile Include="Implementation\Classification\ClassificationSolutionBase.cs" /> 150 150 <Compile Include="Implementation\Classification\DiscriminantFunctionClassificationSolutionBase.cs" /> 151 <Compile Include="Implementation\Classification\WeightCalculators\AccuracyWeightCalculator.cs" />152 151 <Compile Include="Implementation\Classification\WeightCalculators\AverageThresholdCalculator.cs" /> 153 <Compile Include="Implementation\Classification\WeightCalculators\ContinuousPointCertaintyWeightCalculator.cs" /> 152 <Compile Include="Implementation\Classification\WeightCalculators\AverageThresholdClassificationCalculator.cs" /> 153 <Compile Include="Implementation\Classification\WeightCalculators\MedianThresholdClassificationCalculator.cs" /> 154 154 <Compile Include="Implementation\Classification\WeightCalculators\DiscriminantClassificationWeightCalculator.cs" /> 155 <Compile Include="Implementation\Classification\WeightCalculators\MedianPointThresholdCalculator.cs" />156 155 <Compile Include="Implementation\Classification\WeightCalculators\MedianThresholdCalculator.cs" /> 157 <Compile Include="Implementation\Classification\WeightCalculators\NeighbourhoodWeightCalculator.cs" />158 <Compile Include="Implementation\Classification\WeightCalculators\PointCertaintyWeightCalculator.cs" />159 156 <Compile Include="Implementation\Classification\WeightCalculators\MajorityVoteWeightCalculator.cs" /> 160 157 <Compile Include="Implementation\Classification\WeightCalculators\ClassificationWeightCalculator.cs" /> -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleSolution.cs
r7596 r8101 56 56 if (value != null) { 57 57 weightCalculator = value; 58 if (!ProblemData.IsEmpty) 58 if (!ProblemData.IsEmpty) { 59 59 RecalculateResults(); 60 } 60 61 } 61 62 } -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/AverageThresholdCalculator.cs
r7729 r8101 57 57 } 58 58 59 protected override double DiscriminantAggregateEstimatedClassValues(IDictionary<IClassificationSolution, double> estimatedClassValues, IDictionary<IDiscriminantFunctionClassificationSolution, double> estimatedValues) {60 IList<double> values = estimatedValues.Select(x => x.Value).ToList();61 if (values.Count <= 0)62 return double.NaN;63 double avg = values.Average();64 return GetClassValueToAverage(avg);65 }66 private double GetClassValueToAverage(double avg) {67 double classValue = classValues.First();68 for (int i = 0; i < classValues.Count(); i++) {69 if (avg > threshold[i])70 classValue = classValues[i];71 else72 break;73 }74 return classValue;75 }76 77 59 protected override double GetDiscriminantConfidence(IEnumerable<IDiscriminantFunctionClassificationSolution> solutions, int index, double estimatedClassValue) { 78 60 // only works with binary classification -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/DiscriminantClassificationWeightCalculator.cs
r7729 r8101 66 66 67 67 protected virtual double DiscriminantAggregateEstimatedClassValues(IDictionary<IClassificationSolution, double> estimatedClassValues, IDictionary<IDiscriminantFunctionClassificationSolution, double> estimatedValues) { 68 return AggregateEstimatedClassValues(estimatedClassValues);68 return base.AggregateEstimatedClassValues(estimatedClassValues); 69 69 } 70 70 -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/MedianThresholdCalculator.cs
r7729 r8101 57 57 } 58 58 59 protected override double DiscriminantAggregateEstimatedClassValues(IDictionary<IClassificationSolution, double> estimatedClassValues, IDictionary<IDiscriminantFunctionClassificationSolution, double> estimatedValues) {60 IList<double> values = estimatedValues.Select(x => x.Value).ToList();61 if (values.Count <= 0)62 return double.NaN;63 double median = GetMedian(values);64 return GetClassValueToMedian(median);65 }66 private double GetClassValueToMedian(double median) {67 double classValue = classValues.First();68 for (int i = 0; i < classValues.Count(); i++) {69 if (median > threshold[i])70 classValue = classValues[i];71 else72 break;73 }74 return classValue;75 }76 77 59 protected override double GetDiscriminantConfidence(IEnumerable<IDiscriminantFunctionClassificationSolution> solutions, int index, double estimatedClassValue) { 78 60 // only works with binary classification … … 106 88 } 107 89 108 pr ivatedouble GetMedian(IList<double> estimatedValues) {90 protected double GetMedian(IList<double> estimatedValues) { 109 91 int count = estimatedValues.Count; 110 92 if (count % 2 == 0)
Note: See TracChangeset
for help on using the changeset viewer.