Changeset 9845


Ignore:
Timestamp:
08/05/13 09:40:54 (8 years ago)
Author:
mkommend
Message:

#2094: Adapted estimated values view for discriminant function classification solutions.

File:
1 edited

Legend:

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

    r9456 r9845  
    3030  [Content(typeof(IDiscriminantFunctionClassificationSolution))]
    3131  public partial class DiscriminantFunctionClassificationSolutionEstimatedClassValuesView : ClassificationSolutionEstimatedClassValuesView {
    32     private const string TargetClassValuesSeriesname = "TargetVariable";
    33     private const string EstimatedClassValuesSeriesName = "EstimatedClassValues";
    34     private const string EstimatedValuesSeriesName = "EstimatedValues";
     32    private const string TARGETVARIABLE_SERIES_NAME = "TargetVariable";
     33    private const string ESTIMATEDVALUES_SERIES_NAME = "Estimated Class Values (all)";
     34    private const string ESTIMATEDVALUES_TRAINING_SERIES_NAME = "Estimated Class Values (training)";
     35    private const string ESTIMATEDVALUES_TEST_SERIES_NAME = "Estimated Class Values (test)";
     36    private const string ESTIMATEDVALUES_DISCRIMINANT_SERIES_NAME = "Discriminant Values (all)";
    3537
    3638    public new IDiscriminantFunctionClassificationSolution Content {
     
    4951        StringMatrix matrix = null;
    5052        if (Content != null) {
    51           string[,] values = new string[Content.ProblemData.Dataset.Rows, 4];
    52 
     53          string[,] values = new string[Content.ProblemData.Dataset.Rows, 6];
    5354          double[] target = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray();
    54           double[] estimatedClassValues = Content.EstimatedClassValues.ToArray();
     55          double[] estimatedClassValue = Content.EstimatedClassValues.ToArray();
    5556          double[] estimatedValues = Content.EstimatedValues.ToArray();
    5657          for (int row = 0; row < target.Length; row++) {
    5758            values[row, 0] = row.ToString();
    5859            values[row, 1] = target[row].ToString();
    59             values[row, 2] = estimatedClassValues[row].ToString();
    60             values[row, 3] = estimatedValues[row].ToString();
     60            values[row, 2] = estimatedClassValue[row].ToString();
     61            values[row, 5] = estimatedValues[row].ToString();
     62          }
     63
     64          var estimatedTraining = Content.EstimatedTrainingClassValues.GetEnumerator();
     65          estimatedTraining.MoveNext();
     66          foreach (var trainingRow in Content.ProblemData.TrainingIndices) {
     67            values[trainingRow, 3] = estimatedTraining.Current.ToString();
     68            estimatedTraining.MoveNext();
     69          }
     70          var estimatedTest = Content.EstimatedTestClassValues.GetEnumerator();
     71          estimatedTest.MoveNext();
     72          foreach (var testRow in Content.ProblemData.TestIndices) {
     73            values[testRow, 4] = estimatedTest.Current.ToString();
     74            estimatedTest.MoveNext();
    6175          }
    6276
    6377          matrix = new StringMatrix(values);
    64           matrix.ColumnNames = new string[] { "Id", TargetClassValuesSeriesname, EstimatedClassValuesSeriesName, EstimatedValuesSeriesName };
     78          matrix.ColumnNames = new string[] { "Id", TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_SERIES_NAME, ESTIMATEDVALUES_TRAINING_SERIES_NAME, ESTIMATEDVALUES_TEST_SERIES_NAME, ESTIMATEDVALUES_DISCRIMINANT_SERIES_NAME };
    6579          matrix.SortableView = true;
    6680        }
Note: See TracChangeset for help on using the changeset viewer.