- Timestamp:
- 04/16/13 13:13:41 (12 years ago)
- Location:
- branches/OaaS
- Files:
-
- 9 edited
- 6 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS
- Property svn:ignore
-
old new 21 21 protoc.exe 22 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll 23 24 packages
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
-
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs
r8139 r9363 96 96 } 97 97 98 int classValuesCount = Content.ProblemData.Class Values.Count;98 int classValuesCount = Content.ProblemData.Classes; 99 99 int solutionsCount = Content.ClassificationSolutions.Count(); 100 100 string[,] values = new string[indices.Length, 5 + classValuesCount + solutionsCount]; … … 106 106 int row = indices[i]; 107 107 values[i, 0] = row.ToString(); 108 values[i, 1] = target[ i].ToString();108 values[i, 1] = target[row].ToString(); 109 109 //display only indices and target values if no models are present 110 110 if (solutionsCount > 0) { 111 111 values[i, 2] = estimatedClassValues[i].ToString(); 112 values[i, 3] = (target[ i].IsAlmost(estimatedClassValues[i])).ToString();112 values[i, 3] = (target[row].IsAlmost(estimatedClassValues[i])).ToString(); 113 113 var groups = 114 114 estimatedValuesVector[i].GroupBy(x => x).Select(g => new { Key = g.Key, Count = g.Count() }).ToList(); 115 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(); 116 // take care of divide by zero 117 if (estimationCount != 0) { 118 values[i, 4] = (((double)groups.Where(g => g.Key == estimatedClassValues[i]).Single().Count) / estimationCount).ToString(); 119 } else { 120 values[i, 4] = double.NaN.ToString(); 121 } 122 for (int classIndex = 0; classIndex < Content.ProblemData.Classes; classIndex++) { 123 var group = groups.Where(g => g.Key == Content.ProblemData.ClassValues.ElementAt(classIndex)).SingleOrDefault(); 120 124 if (group == null) values[i, 5 + classIndex] = 0.ToString(); 121 125 else values[i, 5 + classIndex] = group.Count.ToString(); -
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionModelView.cs
r7259 r9363 20 20 #endregion 21 21 22 using System; 22 23 using System.Linq; 23 24 using System.Windows.Forms; 24 25 using HeuristicLab.Common; 26 using HeuristicLab.Core; 25 27 using HeuristicLab.Core.Views; 26 28 using HeuristicLab.MainForm; … … 83 85 solutions = solutions.Select(s => cloner.Clone(s)); 84 86 } 85 foreach (var solution in solutions) 86 Content.Add(solution); 87 var solutionCollection = Content as ItemCollection<IClassificationSolution>; 88 if (solutionCollection != null) { 89 solutionCollection.AddRange(solutions); 90 } else { 91 foreach (var solution in solutions) 92 Content.Add(solution); 93 } 94 } 95 } 96 protected override void itemsListView_KeyDown(object sender, KeyEventArgs e) { 97 var solutionCollection = Content as ItemCollection<IClassificationSolution>; 98 if (e.KeyCode == Keys.Delete && solutionCollection != null) { 99 if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) { 100 solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IClassificationSolution)x.Tag)); 101 } 102 } else { 103 base.itemsListView_KeyDown(sender, e); 104 } 105 } 106 protected override void removeButton_Click(object sender, EventArgs e) { 107 var solutionCollection = Content as ItemCollection<IClassificationSolution>; 108 if (itemsListView.SelectedItems.Count > 0 && solutionCollection != null) { 109 solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IClassificationSolution)x.Tag)); 110 itemsListView.SelectedItems.Clear(); 111 } else { 112 base.removeButton_Click(sender, e); 87 113 } 88 114 } -
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionConfusionMatrixView.Designer.cs
r7967 r9363 1 namespace HeuristicLab.Problems.DataAnalysis.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Problems.DataAnalysis.Views { 2 23 partial class ClassificationSolutionConfusionMatrixView { 3 24 /// <summary> -
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationRocCurvesView.Designer.cs
r7967 r9363 1 namespace HeuristicLab.Problems.DataAnalysis.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Problems.DataAnalysis.Views { 2 23 partial class DiscriminantFunctionClassificationRocCurvesView { 3 24 /// <summary> -
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationRocCurvesView.cs
r8139 r9363 114 114 maxThreshold += thresholdIncrement; 115 115 116 List<double> classValues = Content.ProblemData.ClassValues. OrderBy(x => x).ToList();116 List<double> classValues = Content.ProblemData.ClassValues.ToList(); 117 117 118 118 foreach (double classValue in classValues) { -
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationSolutionThresholdView.Designer.cs
r7967 r9363 1 namespace HeuristicLab.Problems.DataAnalysis.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Problems.DataAnalysis.Views { 2 23 partial class DiscriminantFunctionClassificationSolutionThresholdView { 3 24 /// <summary> … … 92 113 93 114 } 94 95 115 #endregion 96 116 -
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationSolutionThresholdView.cs
r8139 r9363 65 65 66 66 this.chart.ChartAreas[0].AxisY.Title = "Estimated Values"; 67 this.chart.ChartAreas[0].AxisY.IsStartedFromZero = false; 67 68 this.chart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true; 68 69 this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true; … … 169 170 chart.Annotations.Clear(); 170 171 int classIndex = 1; 172 IClassificationProblemData problemData = Content.ProblemData; 173 var classValues = Content.Model.ClassValues.ToArray(); 174 Axis y = chart.ChartAreas[0].AxisY; 175 Axis x = chart.ChartAreas[0].AxisX; 176 string name; 171 177 foreach (double threshold in Content.Model.Thresholds) { 172 178 if (!double.IsInfinity(threshold)) { … … 176 182 annotation.LineWidth = 2; 177 183 annotation.LineColor = Color.Red; 178 179 184 annotation.IsInfinitive = true; 180 185 annotation.ClipToChartArea = chart.ChartAreas[0].Name; 181 186 annotation.Tag = classIndex; //save classIndex as Tag to avoid moving the threshold accross class bounderies 182 183 187 annotation.AxisX = chart.ChartAreas[0].AxisX; 184 annotation.AxisY = chart.ChartAreas[0].AxisY;188 annotation.AxisY = y; 185 189 annotation.Y = threshold; 186 190 191 name = problemData.GetClassName(classValues[classIndex - 1]); 192 TextAnnotation beneathLeft = CreateTextAnnotation(name, classIndex, x, y, x.Minimum, threshold, ContentAlignment.TopLeft); 193 TextAnnotation beneathRight = CreateTextAnnotation(name, classIndex, x, y, x.Maximum, threshold, ContentAlignment.TopRight); 194 195 name = problemData.GetClassName(classValues[classIndex]); 196 TextAnnotation aboveLeft = CreateTextAnnotation(name, classIndex, x, y, x.Minimum, threshold, ContentAlignment.BottomLeft); 197 TextAnnotation aboveRight = CreateTextAnnotation(name, classIndex, x, y, x.Maximum, threshold, ContentAlignment.BottomRight); 198 187 199 chart.Annotations.Add(annotation); 200 chart.Annotations.Add(beneathLeft); 201 chart.Annotations.Add(aboveLeft); 202 chart.Annotations.Add(beneathRight); 203 chart.Annotations.Add(aboveRight); 204 205 beneathLeft.ResizeToContent(); 206 beneathRight.ResizeToContent(); 207 aboveLeft.ResizeToContent(); 208 aboveRight.ResizeToContent(); 209 210 beneathRight.Width = -beneathRight.Width; 211 aboveLeft.Height = -aboveLeft.Height; 212 aboveRight.Height = -aboveRight.Height; 213 aboveRight.Width = -aboveRight.Width; 214 188 215 classIndex++; 189 216 } 190 217 } 218 } 219 220 private TextAnnotation CreateTextAnnotation(string name, int classIndex, Axis axisX, Axis axisY, double x, double y, ContentAlignment alignment) { 221 TextAnnotation annotation = new TextAnnotation(); 222 annotation.Text = name; 223 annotation.AllowMoving = true; 224 annotation.AllowResizing = false; 225 annotation.AllowSelecting = false; 226 annotation.IsSizeAlwaysRelative = true; 227 annotation.ClipToChartArea = chart.ChartAreas[0].Name; 228 annotation.Tag = classIndex; 229 annotation.AxisX = axisX; 230 annotation.AxisY = axisY; 231 annotation.Alignment = alignment; 232 annotation.X = x; 233 annotation.Y = y; 234 return annotation; 191 235 } 192 236 … … 238 282 double[] thresholds = Content.Model.Thresholds.ToArray(); 239 283 thresholds[classIndex] = e.NewLocationY; 284 Array.Sort(thresholds); 240 285 Content.Model.SetThresholdsAndClassValues(thresholds, Content.Model.ClassValues); 241 286 }
Note: See TracChangeset
for help on using the changeset viewer.