Changeset 7085 for branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs
- Timestamp:
- 11/28/11 13:47:28 (13 years ago)
- Location:
- branches/RegressionBenchmarks
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RegressionBenchmarks
- Property svn:ignore
-
old new 4 4 *.suo 5 5 *.vsp 6 Doxygen 6 7 Google.ProtocolBuffers-0.9.1.dll 7 8 HeuristicLab 3.3.5.1.ReSharper.user 8 9 HeuristicLab 3.3.6.0.ReSharper.user 9 10 HeuristicLab.4.5.resharper.user 11 HeuristicLab.ExtLibs.6.0.ReSharper.user 10 12 HeuristicLab.resharper.user 11 13 ProtoGen.exe … … 16 18 bin 17 19 protoc.exe 18 HeuristicLab.ExtLibs.6.0.ReSharper.user19 Doxygen
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs
r6740 r7085 24 24 using System.Linq; 25 25 using System.Windows.Forms; 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Data; 27 28 using HeuristicLab.MainForm; … … 96 97 97 98 int classValuesCount = Content.ProblemData.ClassValues.Count; 98 int modelCount = Content.Model.Models.Count();99 string[,] values = new string[indizes.Length, 5 + classValuesCount + modelCount];99 int solutionsCount = Content.ClassificationSolutions.Count(); 100 string[,] values = new string[indizes.Length, 5 + classValuesCount + solutionsCount]; 100 101 double[] target = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray(); 101 102 List<List<double?>> estimatedValuesVector = GetEstimatedValues(SamplesComboBox.SelectedItem.ToString(), indizes, … … 106 107 values[i, 0] = row.ToString(); 107 108 values[i, 1] = target[i].ToString(); 108 values[i, 2] = estimatedClassValues[i].ToString(); 109 values[i, 3] = (target[i] == estimatedClassValues[i]).ToString(); 110 var groups = estimatedValuesVector[i].GroupBy(x => x).Select(g => new { Key = g.Key, Count = g.Count() }).ToList(); 111 var estimationCount = groups.Where(g => g.Key != null).Select(g => g.Count).Sum(); 112 values[i, 4] = (((double)groups.Where(g => g.Key == estimatedClassValues[i]).Single().Count) / estimationCount).ToString(); 113 for (int classIndex = 0; classIndex < Content.ProblemData.ClassValues.Count; classIndex++) { 114 var group = groups.Where(g => g.Key == Content.ProblemData.ClassValues[classIndex]).SingleOrDefault(); 115 if (group == null) values[i, 5 + classIndex] = 0.ToString(); 116 else values[i, 5 + classIndex] = group.Count.ToString(); 109 //display only indices and target values if no models are present 110 if (solutionsCount > 0) { 111 values[i, 2] = estimatedClassValues[i].ToString(); 112 values[i, 3] = (target[i].IsAlmost(estimatedClassValues[i])).ToString(); 113 var groups = 114 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 for (int classIndex = 0; classIndex < Content.ProblemData.ClassValues.Count; classIndex++) { 119 var group = groups.Where(g => g.Key == Content.ProblemData.ClassValues[classIndex]).SingleOrDefault(); 120 if (group == null) values[i, 5 + classIndex] = 0.ToString(); 121 else values[i, 5 + classIndex] = group.Count.ToString(); 122 } 123 for (int modelIndex = 0; modelIndex < estimatedValuesVector[i].Count; modelIndex++) { 124 values[i, 5 + classValuesCount + modelIndex] = estimatedValuesVector[i][modelIndex] == null 125 ? string.Empty 126 : estimatedValuesVector[i][modelIndex].ToString(); 127 } 117 128 } 118 for (int modelIndex = 0; modelIndex < estimatedValuesVector[i].Count; modelIndex++) {119 values[i, 5 + classValuesCount + modelIndex] = estimatedValuesVector[i][modelIndex] == null120 ? string.Empty121 : estimatedValuesVector[i][modelIndex].ToString();122 }123 124 129 } 125 130 … … 131 136 matrix.SortableView = true; 132 137 matrixView.Content = matrix; 133 UpdateColoringOfRows();134 138 } 135 139 … … 162 166 return; 163 167 } 164 bool correctClassified = bool.Parse(matrixView.DataGridView[3, e.RowIndex].Value.ToString()); 168 var cellValue = matrixView.DataGridView[3, e.RowIndex].Value.ToString(); 169 if (string.IsNullOrEmpty(cellValue)) return; 170 bool correctClassified = bool.Parse(cellValue); 165 171 matrixView.DataGridView.Rows[e.RowIndex].DefaultCellStyle.ForeColor = correctClassified ? Color.MediumSeaGreen : Color.Red; 166 }167 168 private void UpdateColoringOfRows() {169 if (InvokeRequired) {170 Invoke((Action)UpdateColoringOfRows);171 return;172 }173 //matrixView.DataGridView.SuspendRepaint();174 //for (int i = 0; i < matrixView.DataGridView.Rows.Count; i++) {175 // bool correctClassified = bool.Parse(matrixView.Content.GetValue(i, 3));176 // matrixView.DataGridView.Rows[i].DefaultCellStyle.ForeColor = correctClassified ? Color.MediumSeaGreen : Color.Red;177 //}178 //matrixView.DataGridView.ResumeRepaint(true);179 172 } 180 173 }
Note: See TracChangeset
for help on using the changeset viewer.