Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/10/11 10:00:09 (14 years ago)
Author:
gkronber
Message:

#1418 Implemented classes for classification based on a discriminant function and thresholds and implemented interfaces and base classes for clustering.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs

    r5624 r5649  
    4242  [StorableClass]
    4343  public sealed class LinearRegression : FixedDataAnalysisAlgorithm<IRegressionProblem> {
    44     private const string LinearRegressionModelResultName = "LinearRegressionModel";
     44    private const string LinearRegressionModelResultName = "Linear regression solution";
    4545
    4646    [StorableConstructor]
     
    5151    public LinearRegression()
    5252      : base() {
     53      Problem = new RegressionProblem();
    5354    }
    5455    [StorableHook(HookType.AfterDeserialization)]
     
    6364      double rmsError, cvRmsError;
    6465      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 model on 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 model via 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)));
    6869    }
    6970
     
    7172      Dataset dataset = problemData.Dataset;
    7273      string targetVariable = problemData.TargetVariable;
    73       IEnumerable<string> allowedInputVariables = problemData.InputVariables.CheckedItems.Select(x => x.Value);
     74      IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
    7475      int samplesStart = problemData.TrainingPartitionStart.Value;
    7576      int samplesEnd = problemData.TrainingPartitionEnd.Value;
    76 
    77       IEnumerable<string> selectedInputVariables = problemData.InputVariables.CheckedItems.Select(x => x.Value);
    7877
    7978      double[,] inputMatrix = LinearRegressionUtil.PrepareInputMatrix(dataset, targetVariable, allowedInputVariables, samplesStart, samplesEnd);
     
    8786      int retVal = 1;
    8887      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");
    9089      rmsError = ar.rmserror;
    9190      cvRmsError = ar.cvrmserror;
Note: See TracChangeset for help on using the changeset viewer.