Changeset 7464 for branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs
- Timestamp:
- 02/07/12 16:50:35 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs
r7259 r7464 102 102 List<List<double?>> estimatedValuesVector = GetEstimatedValues(SamplesComboBox.SelectedItem.ToString(), indizes, 103 103 Content.ClassificationSolutions); 104 List<double> weights = Content.Weights.ToList(); 105 double weightSum = weights.Sum(); 104 106 105 107 for (int i = 0; i < indizes.Length; i++) { … … 111 113 values[i, 2] = estimatedClassValues[i].ToString(); 112 114 values[i, 3] = (target[i].IsAlmost(estimatedClassValues[i])).ToString(); 115 116 IEnumerable<int> indices = FindAllIndices(estimatedValuesVector[i], estimatedClassValues[i]); 117 double confidence = 0.0; 118 foreach (var index in indices) { 119 confidence += weights[index]; 120 } 121 values[i, 4] = (confidence / weightSum).ToString(); 122 //var estimationCount = groups.Where(g => g.Key != null).Select(g => g.Count).Sum(); 123 //values[i, 4] = 124 // (((double)groups.Where(g => g.Key == estimatedClassValues[i]).Single().Count) / estimationCount).ToString(); 125 113 126 var groups = 114 127 estimatedValuesVector[i].GroupBy(x => x).Select(g => new { Key = g.Key, Count = g.Count() }).ToList(); 115 var estimationCount = groups.Where(g => g.Key != null).Select(g => g.Count).Sum();116 values[i, 4] =117 (((double)groups.Where(g => g.Key == estimatedClassValues[i]).Single().Count) / estimationCount).ToString();118 128 for (int classIndex = 0; classIndex < Content.ProblemData.ClassValues.Count; classIndex++) { 119 129 var group = groups.Where(g => g.Key == Content.ProblemData.ClassValues[classIndex]).SingleOrDefault(); … … 136 146 matrix.SortableView = true; 137 147 matrixView.Content = matrix; 148 } 149 150 private IEnumerable<int> FindAllIndices(List<double?> list, double value) { 151 List<int> indices = new List<int>(); 152 for (int i = 0; i < list.Count; i++) { 153 if (list[i].Equals(value)) 154 indices.Add(i); 155 } 156 return indices; 138 157 } 139 158
Note: See TracChangeset
for help on using the changeset viewer.