Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/25/12 13:11:18 (12 years ago)
Author:
sforsten
Message:

#1776:

  • added two calculators to test purposes
  • ClassificationEnsembleSolutionEstimatedClassValuesView shows the current average confidence of the correct and wrong classified samples
  • some calculators have been excluded from the project, so only relevant calculators are shown
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  
    4545    private void InitializeComponent() {
    4646      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();
    4751      this.SuspendLayout();
    4852      //
    4953      // matrixView
    5054      //
    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)));
    5458      this.matrixView.Dock = System.Windows.Forms.DockStyle.None;
    5559      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);
    5761      //
    5862      // SamplesComboBox
    5963      //
    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)));
    6266      this.SamplesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    6367      this.SamplesComboBox.FormattingEnabled = true;
    6468      this.SamplesComboBox.Location = new System.Drawing.Point(4, 4);
    6569      this.SamplesComboBox.Name = "SamplesComboBox";
    66       this.SamplesComboBox.Size = new System.Drawing.Size(303, 21);
     70      this.SamplesComboBox.Size = new System.Drawing.Size(309, 21);
    6771      this.SamplesComboBox.TabIndex = 2;
    6872      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";
    69113      //
    70114      // ClassificationEnsembleSolutionEstimatedClassValuesView
     
    72116      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    73117      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);
    74122      this.Controls.Add(this.SamplesComboBox);
    75123      this.Name = "ClassificationEnsembleSolutionEstimatedClassValuesView";
     124      this.Size = new System.Drawing.Size(659, 285);
    76125      this.Controls.SetChildIndex(this.matrixView, 0);
    77126      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);
    78131      this.ResumeLayout(false);
     132      this.PerformLayout();
    79133
    80134    }
     
    83137
    84138    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;
    85143
    86144  }
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs

    r7866 r8101  
    105105      IClassificationEnsembleSolutionWeightCalculator weightCalc = Content.WeightCalculator;
    106106
     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
    107113      for (int i = 0; i < indizes.Length; i++) {
    108114        int row = indizes[i];
     
    112118        if (solutionsCount > 0) {
    113119          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();
    116132
    117133          var groups =
     
    129145        }
    130146      }
     147
     148      CorrectClassifiedConfidence.Text = (confidence[0] / (double)classified[0]).ToString();
     149      WrongClassifiedConfidence.Text = (confidence[1] / (double)classified[1]).ToString();
    131150
    132151      StringMatrix matrix = new StringMatrix(values);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj

    r7866 r8101  
    149149    <Compile Include="Implementation\Classification\ClassificationSolutionBase.cs" />
    150150    <Compile Include="Implementation\Classification\DiscriminantFunctionClassificationSolutionBase.cs" />
    151     <Compile Include="Implementation\Classification\WeightCalculators\AccuracyWeightCalculator.cs" />
    152151    <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" />
    154154    <Compile Include="Implementation\Classification\WeightCalculators\DiscriminantClassificationWeightCalculator.cs" />
    155     <Compile Include="Implementation\Classification\WeightCalculators\MedianPointThresholdCalculator.cs" />
    156155    <Compile Include="Implementation\Classification\WeightCalculators\MedianThresholdCalculator.cs" />
    157     <Compile Include="Implementation\Classification\WeightCalculators\NeighbourhoodWeightCalculator.cs" />
    158     <Compile Include="Implementation\Classification\WeightCalculators\PointCertaintyWeightCalculator.cs" />
    159156    <Compile Include="Implementation\Classification\WeightCalculators\MajorityVoteWeightCalculator.cs" />
    160157    <Compile Include="Implementation\Classification\WeightCalculators\ClassificationWeightCalculator.cs" />
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleSolution.cs

    r7596 r8101  
    5656        if (value != null) {
    5757          weightCalculator = value;
    58           if (!ProblemData.IsEmpty)
     58          if (!ProblemData.IsEmpty) {
    5959            RecalculateResults();
     60          }
    6061        }
    6162      }
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/AverageThresholdCalculator.cs

    r7729 r8101  
    5757    }
    5858
    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         else
    72           break;
    73       }
    74       return classValue;
    75     }
    76 
    7759    protected override double GetDiscriminantConfidence(IEnumerable<IDiscriminantFunctionClassificationSolution> solutions, int index, double estimatedClassValue) {
    7860      // only works with binary classification
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/DiscriminantClassificationWeightCalculator.cs

    r7729 r8101  
    6666
    6767    protected virtual double DiscriminantAggregateEstimatedClassValues(IDictionary<IClassificationSolution, double> estimatedClassValues, IDictionary<IDiscriminantFunctionClassificationSolution, double> estimatedValues) {
    68       return AggregateEstimatedClassValues(estimatedClassValues);
     68      return base.AggregateEstimatedClassValues(estimatedClassValues);
    6969    }
    7070
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/MedianThresholdCalculator.cs

    r7729 r8101  
    5757    }
    5858
    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         else
    72           break;
    73       }
    74       return classValue;
    75     }
    76 
    7759    protected override double GetDiscriminantConfidence(IEnumerable<IDiscriminantFunctionClassificationSolution> solutions, int index, double estimatedClassValue) {
    7860      // only works with binary classification
     
    10688    }
    10789
    108     private double GetMedian(IList<double> estimatedValues) {
     90    protected double GetMedian(IList<double> estimatedValues) {
    10991      int count = estimatedValues.Count;
    11092      if (count % 2 == 0)
Note: See TracChangeset for help on using the changeset viewer.