Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6255 for trunk/sources


Ignore:
Timestamp:
05/23/11 16:13:43 (14 years ago)
Author:
gkronber
Message:

#1450 Implemented changes in estimated values views for regression and classification solutions specific to ensemble solutions.

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionEstimatedClassValuesView.cs

    r6239 r6255  
    3333  public partial class ClassificationSolutionEstimatedClassValuesView : ItemView, IClassificationSolutionEvaluationView {
    3434    private const string TARGETVARIABLE_SERIES_NAME = "Target Variable";
     35    private const string ESTIMATEDVALUES_SERIES_NAME = "Estimated Class Values (all)";
    3536    private const string ESTIMATEDVALUES_TRAINING_SERIES_NAME = "Estimated Class Values (training)";
    3637    private const string ESTIMATEDVALUES_TEST_SERIES_NAME = "Estimated Class Values (test)";
     
    8485      if (InvokeRequired) Invoke((Action)UpdateEstimatedValues);
    8586      else {
    86         DoubleMatrix matrix = null;
     87        StringMatrix matrix = null;
    8788        if (Content != null) {
    88           double[,] values = new double[Content.ProblemData.Dataset.Rows, 3];
    89           // fill with NaN
    90           for (int row = 0; row < Content.ProblemData.Dataset.Rows; row++)
    91             for (int column = 0; column < 3; column++)
    92               values[row, column] = double.NaN;
     89          string[,] values = new string[Content.ProblemData.Dataset.Rows, 5];
    9390
    9491          double[] target = Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable);
     92          double[] estimated = Content.EstimatedClassValues.ToArray();
    9593          for (int row = 0; row < target.Length; row++) {
    96             values[row, 0] = target[row];
     94            values[row, 0] = row.ToString();
     95            values[row, 1] = target[row].ToString();
     96            values[row, 2] = estimated[row].ToString();
    9797          }
     98
    9899          var estimatedTraining = Content.EstimatedTrainingClassValues.GetEnumerator();
    99100          estimatedTraining.MoveNext();
    100101          foreach (var trainingRow in Content.ProblemData.TrainingIndizes) {
    101             values[trainingRow, 1] = estimatedTraining.Current;
     102            values[trainingRow, 3] = estimatedTraining.Current.ToString();
    102103            estimatedTraining.MoveNext();
    103104          }
     
    105106          estimatedTest.MoveNext();
    106107          foreach (var testRow in Content.ProblemData.TestIndizes) {
    107             values[testRow, 2] = estimatedTest.Current;
     108            values[testRow, 4] = estimatedTest.Current.ToString();
    108109            estimatedTest.MoveNext();
    109110          }
    110111
    111           matrix = new DoubleMatrix(values);
    112           matrix.ColumnNames = new string[] { TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_TRAINING_SERIES_NAME, ESTIMATEDVALUES_TEST_SERIES_NAME };
     112          matrix = new StringMatrix(values);
     113          matrix.ColumnNames = new string[] {"Id", TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_SERIES_NAME, ESTIMATEDVALUES_TRAINING_SERIES_NAME, ESTIMATEDVALUES_TEST_SERIES_NAME };
     114          matrix.SortableView = true;
    113115        }
    114116        matrixView.Content = matrix;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationSolutionEstimatedClassValuesView.cs

    r5975 r6255  
    8484      if (InvokeRequired) Invoke((Action)UpdateEstimatedValues);
    8585      else {
    86         DoubleMatrix matrix = null;
     86        StringMatrix matrix = null;
    8787        if (Content != null) {
    88           double[,] values = new double[Content.ProblemData.Dataset.Rows, 3];
     88          string[,] values = new string[Content.ProblemData.Dataset.Rows, 5];
    8989
    9090          double[] target = Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable);
     
    9292          double[] estimatedValues = Content.EstimatedValues.ToArray();
    9393          for (int row = 0; row < target.Length; row++) {
    94             values[row, 0] = target[row];
    95             values[row, 1] = estimatedClassValues[row];
    96             values[row, 2] = estimatedValues[row];
     94            values[row, 0] = row.ToString();
     95            values[row, 1] = target[row].ToString();
     96            values[row, 2] = estimatedClassValues[row].ToString();
     97            values[row, 3] = estimatedValues[row].ToString();
    9798          }
    9899
    99           matrix = new DoubleMatrix(values);
    100           matrix.ColumnNames = new string[] { TargetClassValuesSeriesname, EstimatedClassValuesSeriesName, EstimatedValuesSeriesName };
     100          matrix = new StringMatrix(values);
     101          matrix.ColumnNames = new string[] { "Id", TargetClassValuesSeriesname, EstimatedClassValuesSeriesName, EstimatedValuesSeriesName };
     102          matrix.SortableView = true;
    101103        }
    102104        matrixView.Content = matrix;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionEstimatedValuesView.cs

    r6238 r6255  
    2727using HeuristicLab.MainForm;
    2828using HeuristicLab.MainForm.WindowsForms;
     29using System.Globalization;
    2930
    3031namespace HeuristicLab.Problems.DataAnalysis.Views {
     
    3334  public partial class RegressionSolutionEstimatedValuesView : ItemView, IRegressionSolutionEvaluationView {
    3435    private const string TARGETVARIABLE_SERIES_NAME = "Target Variable";
     36    private const string ESTIMATEDVALUES_SERIES_NAME = "Estimated Values (all)";
    3537    private const string ESTIMATEDVALUES_TRAINING_SERIES_NAME = "Estimated Values (training)";
    3638    private const string ESTIMATEDVALUES_TEST_SERIES_NAME = "Estimated Values (test)";
     
    8486      if (InvokeRequired) Invoke((Action)UpdateEstimatedValues);
    8587      else {
    86         DoubleMatrix matrix = null;
     88        StringMatrix matrix = null;
    8789        if (Content != null) {
    88           double[,] values = new double[Content.ProblemData.Dataset.Rows, 5];
    89           // initialize to double.NaN
    90           for (int row = 0; row < Content.ProblemData.Dataset.Rows; row++)
    91             for (int column = 0; column < 5; column++)
    92               values[row, column] = double.NaN;
     90          string[,] values = new string[Content.ProblemData.Dataset.Rows, 7];
    9391
    9492          double[] target = Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable);
     93          var estimated = Content.EstimatedValues.GetEnumerator();
    9594          var estimated_training = Content.EstimatedTrainingValues.GetEnumerator();
    9695          var estimated_test = Content.EstimatedTestValues.GetEnumerator();
     
    9897          foreach (var row in Content.ProblemData.TrainingIndizes) {
    9998            estimated_training.MoveNext();
    100             values[row, 1] = estimated_training.Current;
     99            values[row, 3] = estimated_training.Current.ToString();
    101100          }
    102101
    103102          foreach (var row in Content.ProblemData.TestIndizes) {
    104103            estimated_test.MoveNext();
    105             values[row, 2] = estimated_test.Current;
     104            values[row, 4] = estimated_test.Current.ToString();
    106105          }
    107106
    108           for (int row = 0; row < target.Length; row++) {
    109             values[row, 0] = target[row];
    110             double est = values[row, 1];
    111             if (!double.IsNaN(est)) {
    112               values[row, 3] = Math.Abs(est - target[row]);
    113               values[row, 4] = Math.Abs(values[row, 3] / target[row]);
    114             }
     107          foreach (var row in Enumerable.Range(0, Content.ProblemData.Dataset.Rows)) {
     108            estimated.MoveNext();
     109            double est = estimated.Current;
     110            double res = Math.Abs(est - target[row]);
     111            values[row, 0] = row.ToString();
     112            values[row, 1] = target[row].ToString();
     113            values[row, 2] = est.ToString();
     114            values[row, 5] = Math.Abs(res).ToString();
     115            values[row, 6] = Math.Abs(res / est).ToString();
    115116          }
    116117
    117           matrix = new DoubleMatrix(values);
    118           matrix.ColumnNames = new string[] { TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_TRAINING_SERIES_NAME, ESTIMATEDVALUES_TEST_SERIES_NAME, "Absolute Error (training)", "Relative Error (training)" };
     118          matrix = new StringMatrix(values);
     119          matrix.ColumnNames = new string[] { "Id", TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_SERIES_NAME, ESTIMATEDVALUES_TRAINING_SERIES_NAME, ESTIMATEDVALUES_TEST_SERIES_NAME, "Absolute Error (all)", "Relative Error (all)" };
     120          matrix.SortableView = true;
    119121        }
    120122        matrixView.Content = matrix;
Note: See TracChangeset for help on using the changeset viewer.