Changeset 5649 for branches/DataAnalysis Refactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear
- Timestamp:
- 03/10/11 10:00:09 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs
r5624 r5649 42 42 [StorableClass] 43 43 public sealed class LinearRegression : FixedDataAnalysisAlgorithm<IRegressionProblem> { 44 private const string LinearRegressionModelResultName = "Linear RegressionModel";44 private const string LinearRegressionModelResultName = "Linear regression solution"; 45 45 46 46 [StorableConstructor] … … 51 51 public LinearRegression() 52 52 : base() { 53 Problem = new RegressionProblem(); 53 54 } 54 55 [StorableHook(HookType.AfterDeserialization)] … … 63 64 double rmsError, cvRmsError; 64 65 var solution = CreateLinearRegressionSolution(Problem.ProblemData, out rmsError, out cvRmsError); 65 Results.Add(new Result(LinearRegressionModelResultName, "The linear regression model.", solution));66 Results.Add(new Result("Root mean square error", "The root of the mean of squared errors of the linear regression modelon the training set.", new DoubleValue(rmsError)));67 Results.Add(new Result("Estimated root mean square error (cross-validation)", "The estimated root of the mean of squared errors of the linear regression modelvia cross validation.", new DoubleValue(cvRmsError)));66 Results.Add(new Result(LinearRegressionModelResultName, "The linear regression solution.", solution)); 67 Results.Add(new Result("Root mean square error", "The root of the mean of squared errors of the linear regression solution on the training set.", new DoubleValue(rmsError))); 68 Results.Add(new Result("Estimated root mean square error (cross-validation)", "The estimated root of the mean of squared errors of the linear regression solution via cross validation.", new DoubleValue(cvRmsError))); 68 69 } 69 70 … … 71 72 Dataset dataset = problemData.Dataset; 72 73 string targetVariable = problemData.TargetVariable; 73 IEnumerable<string> allowedInputVariables = problemData. InputVariables.CheckedItems.Select(x => x.Value);74 IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables; 74 75 int samplesStart = problemData.TrainingPartitionStart.Value; 75 76 int samplesEnd = problemData.TrainingPartitionEnd.Value; 76 77 IEnumerable<string> selectedInputVariables = problemData.InputVariables.CheckedItems.Select(x => x.Value);78 77 79 78 double[,] inputMatrix = LinearRegressionUtil.PrepareInputMatrix(dataset, targetVariable, allowedInputVariables, samplesStart, samplesEnd); … … 87 86 int retVal = 1; 88 87 alglib.lrbuild(inputMatrix, nRows, nFeatures, out retVal, out lm, out ar); 89 if (retVal != 1) throw new ArgumentException("Error in calculation of linear regression model");88 if (retVal != 1) throw new ArgumentException("Error in calculation of linear regression solution"); 90 89 rmsError = ar.rmserror; 91 90 cvRmsError = ar.cvrmserror;
Note: See TracChangeset
for help on using the changeset viewer.