Changeset 17991 for branches/3128_Prediction_Intervals/HeuristicLab.Algorithms.DataAnalysis.Glmnet/3.4/ElasticNetLinearRegression.cs
- Timestamp:
- 06/16/21 21:35:37 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3128_Prediction_Intervals/HeuristicLab.Algorithms.DataAnalysis.Glmnet/3.4/ElasticNetLinearRegression.cs
r17180 r17991 34 34 using HeuristicLab.Problems.DataAnalysis.Symbolic; 35 35 using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression; 36 using HeuristicLab.Analysis.Statistics; 36 37 37 38 namespace HeuristicLab.Algorithms.DataAnalysis.Glmnet { … … 88 89 } 89 90 90 private void CreateSolution(double lambda) {91 private void CreateSolution(double lambda) { 91 92 double trainNMSE; 92 93 double testNMSE; … … 97 98 var solution = CreateSymbolicSolution(coeff, Problem.ProblemData); 98 99 Results.Add(new Result(solution.Name, solution.Description, solution)); 100 101 var xy = Problem.ProblemData.Dataset.ToArray(Problem.ProblemData.AllowedInputVariables.Concat(new[] { Problem.ProblemData.TargetVariable }), Problem.ProblemData.TrainingIndices); 102 // prepare xy for calculation of parameter statistics 103 // the last coefficient is the offset 104 var resid = new double[xy.GetLength(0)]; 105 for (int r = 0; r < xy.GetLength(0); r++) { 106 resid[r] = xy[r, coeff.Length - 1] - coeff[coeff.Length - 1]; 107 xy[r, coeff.Length - 1] = 1.0; 108 } 109 var statistics = Statistics.CalculateParameterStatistics(xy, coeff, resid); 110 Results.AddOrUpdateResult("Statistics", statistics.AsResultCollection(Problem.ProblemData.AllowedInputVariables.Concat(new string[] { "<const>" }))); 99 111 } 100 112
Note: See TracChangeset
for help on using the changeset viewer.