Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/12/20 11:45:38 (5 years ago)
Author:
mkommend
Message:

#3038: Removed filtering of variables with only one distinct value in ResidualAnalysisView.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualAnalysisView.cs

    r17341 r17539  
    8888      var ds = problemData.Dataset;
    8989      var runs = new RunCollection();
    90       // determine relevant variables (at least two different values)
    91       var doubleVars = ds.DoubleVariables.Where(vn => ds.GetDoubleValues(vn).Distinct().Skip(1).Any()).ToArray();
    92       var stringVars = ds.StringVariables.Where(vn => ds.GetStringValues(vn).Distinct().Skip(1).Any()).ToArray();
    93       var dateTimeVars = ds.DateTimeVariables.Where(vn => ds.GetDateTimeValues(vn).Distinct().Skip(1).Any()).ToArray();
     90
     91      var doubleVars = ds.DoubleVariables.ToArray();
     92      var stringVars = ds.StringVariables.ToArray();
     93      var dateTimeVars = ds.DateTimeVariables.ToArray();
    9494
    9595      var predictedValues = Content.EstimatedValues.ToArray();
     96      var targetValues = ds.GetReadOnlyDoubleValues(problemData.TargetVariable);
     97
    9698      foreach (var i in problemData.AllIndices) {
    9799        var run = CreateRunForIdx(i, problemData, doubleVars, stringVars, dateTimeVars);
    98         var targetValue = ds.GetDoubleValue(problemData.TargetVariable, i);
    99         AddErrors(run, predictedValues[i], targetValue);
     100        AddErrors(run, predictedValues[i], targetValues[i]);
    100101
    101102        if (problemData.IsTrainingSample(i) && problemData.IsTestSample(i)) {
     
    125126    }
    126127
    127     private void AddErrors(IRun run, double pred, double target) {
     128    private static void AddErrors(IRun run, double pred, double target) {
    128129      var residual = target - pred;
    129130      var relError = residual / target;
     
    136137    }
    137138
    138     private IRun CreateRunForIdx(int i, IRegressionProblemData problemData, IEnumerable<string> doubleVars, IEnumerable<string> stringVars, IEnumerable<string> dateTimeVars) {
     139    private static IRun CreateRunForIdx(int i, IRegressionProblemData problemData, IEnumerable<string> doubleVars, IEnumerable<string> stringVars, IEnumerable<string> dateTimeVars) {
    139140      var ds = problemData.Dataset;
    140141      var run = new Run();
Note: See TracChangeset for help on using the changeset viewer.