Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/13/09 17:28:07 (15 years ago)
Author:
gkronber
Message:

Worked on #722 (IModel should provide a Predict() method to get predicted values for an input vector).
At the same time removed parameter PunishmentFactor from GP algorithms (this parameter is internal to TreeEvaluators now).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.LinearRegression/3.2/LinearRegression.cs

    r2270 r2285  
    6969    }
    7070
    71     public IModel Model {
     71    public IAnalyzerModel Model {
    7272      get {
    7373        if (!engine.Terminated) throw new InvalidOperationException("The algorithm is still running. Wait until the algorithm is terminated to retrieve the result.");
     
    268268
    269269
    270     protected internal virtual Model CreateLRModel(IScope bestModelScope) {
    271       Model model = new Model();
     270    protected internal virtual IAnalyzerModel CreateLRModel(IScope bestModelScope) {
     271      IGeneticProgrammingModel tree = bestModelScope.GetVariableValue<IGeneticProgrammingModel>("LinearRegressionModel", false);
     272      ITreeEvaluator evaluator = bestModelScope.GetVariableValue<ITreeEvaluator>("TreeEvaluator", false);
     273      IAnalyzerModel model = new AnalyzerModel();
     274      model.Predictor = new Predictor(evaluator, tree);
    272275      model.TrainingMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("TrainingQuality", false).Data;
    273276      model.ValidationMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("ValidationQuality", false).Data;
     
    286289      model.TestVarianceAccountedFor = bestModelScope.GetVariableValue<DoubleData>("TestVAF", false).Data;
    287290
    288       model.Data = bestModelScope.GetVariableValue<IGeneticProgrammingModel>("LinearRegressionModel", false);
    289291      HeuristicLab.DataAnalysis.Dataset ds = bestModelScope.GetVariableValue<Dataset>("Dataset", true);
    290292      model.Dataset = ds;
     
    303305        double impact = ((DoubleData)row[1]).Data;
    304306        model.SetVariableEvaluationImpact(variableName, impact);
    305         model.AddInputVariables(variableName);
     307        model.AddInputVariable(variableName);
    306308      }
    307309      foreach (ItemList row in qualityImpacts) {
     
    309311        double impact = ((DoubleData)row[1]).Data;
    310312        model.SetVariableQualityImpact(variableName, impact);
    311         model.AddInputVariables(variableName);
     313        model.AddInputVariable(variableName);
    312314      }
    313315
Note: See TracChangeset for help on using the changeset viewer.