Changeset 6760 for branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionEstimatedClassValuesView.cs
- Timestamp:
- 09/14/11 13:59:25 (13 years ago)
- Location:
- branches/PersistenceSpeedUp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceSpeedUp
- Property svn:ignore
-
old new 12 12 *.psess 13 13 *.vsp 14 *.docstates
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionEstimatedClassValuesView.cs
r5975 r6760 22 22 using System.Linq; 23 23 using System.Windows.Forms; 24 using HeuristicLab.Core.Views;25 24 using HeuristicLab.Data; 26 25 using HeuristicLab.Data.Views; … … 31 30 [View("Estimated Class Values")] 32 31 [Content(typeof(IClassificationSolution))] 33 public partial class ClassificationSolutionEstimatedClassValuesView : ItemView, IClassificationSolutionEvaluationView { 34 private const string TARGETVARIABLE_SERIES_NAME = "TargetVariable"; 35 private const string ESTIMATEDVALUES_SERIES_NAME = "EstimatedClassValues"; 32 public partial class ClassificationSolutionEstimatedClassValuesView : DataAnalysisSolutionEvaluationView { 33 private const string TARGETVARIABLE_SERIES_NAME = "Target Variable"; 34 private const string ESTIMATEDVALUES_SERIES_NAME = "Estimated Class Values (all)"; 35 private const string ESTIMATEDVALUES_TRAINING_SERIES_NAME = "Estimated Class Values (training)"; 36 private const string ESTIMATEDVALUES_TEST_SERIES_NAME = "Estimated Class Values (test)"; 36 37 37 38 public new IClassificationSolution Content { 38 39 get { return (IClassificationSolution)base.Content; } 39 set { 40 base.Content = value; 41 } 40 set { base.Content = value; } 42 41 } 43 42 44 pr ivateStringConvertibleMatrixView matrixView;43 protected StringConvertibleMatrixView matrixView; 45 44 46 45 public ClassificationSolutionEstimatedClassValuesView() … … 80 79 } 81 80 82 pr ivatevoid UpdateEstimatedValues() {81 protected virtual void UpdateEstimatedValues() { 83 82 if (InvokeRequired) Invoke((Action)UpdateEstimatedValues); 84 83 else { 85 DoubleMatrix matrix = null;84 StringMatrix matrix = null; 86 85 if (Content != null) { 87 double[,] values = new double[Content.ProblemData.Dataset.Rows, 2];86 string[,] values = new string[Content.ProblemData.Dataset.Rows, 5]; 88 87 89 double[] target = Content.ProblemData.Dataset.Get VariableValues(Content.ProblemData.TargetVariable);88 double[] target = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray(); 90 89 double[] estimated = Content.EstimatedClassValues.ToArray(); 91 90 for (int row = 0; row < target.Length; row++) { 92 values[row, 0] = target[row]; 93 values[row, 1] = estimated[row]; 91 values[row, 0] = row.ToString(); 92 values[row, 1] = target[row].ToString(); 93 values[row, 2] = estimated[row].ToString(); 94 94 } 95 95 96 matrix = new DoubleMatrix(values); 97 matrix.ColumnNames = new string[] { TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_SERIES_NAME }; 96 var estimatedTraining = Content.EstimatedTrainingClassValues.GetEnumerator(); 97 estimatedTraining.MoveNext(); 98 foreach (var trainingRow in Content.ProblemData.TrainingIndizes) { 99 values[trainingRow, 3] = estimatedTraining.Current.ToString(); 100 estimatedTraining.MoveNext(); 101 } 102 var estimatedTest = Content.EstimatedTestClassValues.GetEnumerator(); 103 estimatedTest.MoveNext(); 104 foreach (var testRow in Content.ProblemData.TestIndizes) { 105 values[testRow, 4] = estimatedTest.Current.ToString(); 106 estimatedTest.MoveNext(); 107 } 108 109 matrix = new StringMatrix(values); 110 matrix.ColumnNames = new string[] { "Id", TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_SERIES_NAME, ESTIMATEDVALUES_TRAINING_SERIES_NAME, ESTIMATEDVALUES_TEST_SERIES_NAME }; 111 matrix.SortableView = true; 98 112 } 99 113 matrixView.Content = matrix;
Note: See TracChangeset
for help on using the changeset viewer.