Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/07/11 18:11:23 (14 years ago)
Author:
gkronber
Message:

#1418 renamed interface for interpreter, worked on solutions and models and implemented SVM regression.

File:
1 edited

Legend:

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

    r5617 r5624  
    3232using System.Collections.Generic;
    3333using HeuristicLab.Problems.DataAnalysis.Symbolic;
     34using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
    3435
    3536namespace HeuristicLab.Algorithms.DataAnalysis {
     
    6162    protected override void Run() {
    6263      double rmsError, cvRmsError;
    63       IRegressionProblemData problemData = Problem.ProblemData;
    64       int samplesStart = problemData.TrainingPartitionStart.Value;
    65       int samplesEnd = problemData.TrainingPartitionEnd.Value;
    66       IEnumerable<string> selectedInputVariables = problemData.InputVariables.CheckedItems.Select(x => x.Value);
    67       var solution = CreateLinearRegressionSolution(problemData.Dataset, problemData.TargetVariable, selectedInputVariables, samplesStart, samplesEnd, out rmsError, out cvRmsError);
     64      var solution = CreateLinearRegressionSolution(Problem.ProblemData, out rmsError, out cvRmsError);
    6865      Results.Add(new Result(LinearRegressionModelResultName, "The linear regression model.", solution));
    6966      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)));
     
    7168    }
    7269
    73     public static ISymbolicExpressionTree CreateLinearRegressionSolution(Dataset dataset, string targetVariable, IEnumerable<string> allowedInputVariables, int start, int end, out double rmsError, out double cvRmsError) {
    74       double[,] inputMatrix = LinearRegressionUtil.PrepareInputMatrix(dataset, targetVariable, allowedInputVariables, start, end);
     70    public static ISymbolicRegressionSolution CreateLinearRegressionSolution(IRegressionProblemData problemData, out double rmsError, out double cvRmsError) {
     71      Dataset dataset = problemData.Dataset;
     72      string targetVariable = problemData.TargetVariable;
     73      IEnumerable<string> allowedInputVariables = problemData.InputVariables.CheckedItems.Select(x => x.Value);
     74      int samplesStart = problemData.TrainingPartitionStart.Value;
     75      int samplesEnd = problemData.TrainingPartitionEnd.Value;
     76
     77      IEnumerable<string> selectedInputVariables = problemData.InputVariables.CheckedItems.Select(x => x.Value);
     78
     79      double[,] inputMatrix = LinearRegressionUtil.PrepareInputMatrix(dataset, targetVariable, allowedInputVariables, samplesStart, samplesEnd);
    7580
    7681      alglib.linearmodel lm = new alglib.linearmodel();
     
    107112      addition.AddSubTree(cNode);
    108113
    109       return tree;
     114      SymbolicRegressionSolution solution = new SymbolicRegressionSolution(new SymbolicRegressionModel(tree, new SymbolicDataAnalysisExpressionTreeInterpreter()), problemData);
     115      return solution;
    110116    }
    111117    #endregion
Note: See TracChangeset for help on using the changeset viewer.