Changeset 17539
- Timestamp:
- 05/12/20 11:45:38 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualAnalysisView.cs
r17341 r17539 88 88 var ds = problemData.Dataset; 89 89 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(); 94 94 95 95 var predictedValues = Content.EstimatedValues.ToArray(); 96 var targetValues = ds.GetReadOnlyDoubleValues(problemData.TargetVariable); 97 96 98 foreach (var i in problemData.AllIndices) { 97 99 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]); 100 101 101 102 if (problemData.IsTrainingSample(i) && problemData.IsTestSample(i)) { … … 125 126 } 126 127 127 private void AddErrors(IRun run, double pred, double target) {128 private static void AddErrors(IRun run, double pred, double target) { 128 129 var residual = target - pred; 129 130 var relError = residual / target; … … 136 137 } 137 138 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) { 139 140 var ds = problemData.Dataset; 140 141 var run = new Run();
Note: See TracChangeset
for help on using the changeset viewer.