Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/20/18 11:54:35 (5 years ago)
Author:
pfleck
Message:

#2845 Merged trunk changes before source move into branch

Location:
branches/2845_EnhancedProgress
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2845_EnhancedProgress

  • branches/2845_EnhancedProgress/HeuristicLab.Algorithms.DataAnalysis

  • branches/2845_EnhancedProgress/HeuristicLab.Algorithms.DataAnalysis/3.4

    • Property svn:mergeinfo set to (toggle deleted branches)
      /stable/HeuristicLab.Algorithms.DataAnalysis/3.4mergedeligible
      /branches/1721-RandomForestPersistence/HeuristicLab.Algorithms.DataAnalysis/3.410321-10322
      /branches/Async/HeuristicLab.Algorithms.DataAnalysis/3.413329-15286
      /branches/Benchmarking/sources/HeuristicLab.Algorithms.DataAnalysis/3.46917-7005
      /branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.49070-13099
      /branches/CloningRefactoring/HeuristicLab.Algorithms.DataAnalysis/3.44656-4721
      /branches/DataAnalysis Refactoring/HeuristicLab.Algorithms.DataAnalysis/3.45471-5808
      /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Algorithms.DataAnalysis/3.45815-6180
      /branches/DataAnalysis/HeuristicLab.Algorithms.DataAnalysis/3.44458-4459,​4462,​4464
      /branches/DataPreprocessing/HeuristicLab.Algorithms.DataAnalysis/3.410085-11101
      /branches/GP.Grammar.Editor/HeuristicLab.Algorithms.DataAnalysis/3.46284-6795
      /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Algorithms.DataAnalysis/3.45060
      /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Algorithms.DataAnalysis/3.411570-12508
      /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Algorithms.DataAnalysis/3.411130-12721
      /branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.413819-14091
      /branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.48116-8789
      /branches/LogResidualEvaluator/HeuristicLab.Algorithms.DataAnalysis/3.410202-10483
      /branches/NET40/sources/HeuristicLab.Algorithms.DataAnalysis/3.45138-5162
      /branches/ParallelEngine/HeuristicLab.Algorithms.DataAnalysis/3.45175-5192
      /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Algorithms.DataAnalysis/3.47773-7810
      /branches/QAPAlgorithms/HeuristicLab.Algorithms.DataAnalysis/3.46350-6627
      /branches/Restructure trunk solution/HeuristicLab.Algorithms.DataAnalysis/3.46828
      /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Algorithms.DataAnalysis/3.410204-10479
      /branches/SuccessProgressAnalysis/HeuristicLab.Algorithms.DataAnalysis/3.45370-5682
      /branches/Trunk/HeuristicLab.Algorithms.DataAnalysis/3.46829-6865
      /branches/VNS/HeuristicLab.Algorithms.DataAnalysis/3.45594-5752
      /branches/Weighted TSNE/3.415451-15531
      /branches/histogram/HeuristicLab.Algorithms.DataAnalysis/3.45959-6341
      /branches/symbreg-factors-2650/HeuristicLab.Algorithms.DataAnalysis/3.414232-14825
      /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.415415-15681
  • branches/2845_EnhancedProgress/HeuristicLab.Algorithms.DataAnalysis/3.4/NonlinearRegression/NonlinearRegression.cs

    r14826 r16307  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    5151    private const string SeedParameterName = "Seed";
    5252    private const string InitParamsRandomlyParameterName = "InitializeParametersRandomly";
     53    private const string ApplyLinearScalingParameterName = "Apply linear scaling";
    5354
    5455    public IFixedValueParameter<StringValue> ModelStructureParameter {
     
    7374    public IFixedValueParameter<BoolValue> InitParametersRandomlyParameter {
    7475      get { return (IFixedValueParameter<BoolValue>)Parameters[InitParamsRandomlyParameterName]; }
     76    }
     77
     78    public IFixedValueParameter<BoolValue> ApplyLinearScalingParameter {
     79      get { return (IFixedValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
    7580    }
    7681
     
    103108      get { return InitParametersRandomlyParameter.Value.Value; }
    104109      set { InitParametersRandomlyParameter.Value.Value = value; }
     110    }
     111
     112    public bool ApplyLinearScaling {
     113      get { return ApplyLinearScalingParameter.Value.Value; }
     114      set { ApplyLinearScalingParameter.Value.Value = value; }
    105115    }
    106116
     
    119129      Parameters.Add(new FixedValueParameter<BoolValue>(SetSeedRandomlyParameterName, "Switch to determine if the random number seed should be initialized randomly.", new BoolValue(true)));
    120130      Parameters.Add(new FixedValueParameter<BoolValue>(InitParamsRandomlyParameterName, "Switch to determine if the real-valued model parameters should be initialized randomly in each restart.", new BoolValue(false)));
     131      Parameters.Add(new FixedValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Switch to determine if linear scaling terms should be added to the model", new BoolValue(true)));
    121132
    122133      SetParameterHiddenState();
     
    146157      if (!Parameters.ContainsKey(InitParamsRandomlyParameterName))
    147158        Parameters.Add(new FixedValueParameter<BoolValue>(InitParamsRandomlyParameterName, "Switch to determine if the numeric parameters of the model should be initialized randomly.", new BoolValue(false)));
     159      if (!Parameters.ContainsKey(ApplyLinearScalingParameterName))
     160        Parameters.Add(new FixedValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Switch to determine if linear scaling terms should be added to the model", new BoolValue(true)));
     161
    148162
    149163      SetParameterHiddenState();
     
    174188        if (SetSeedRandomly) Seed = (new System.Random()).Next();
    175189        var rand = new MersenneTwister((uint)Seed);
    176         bestSolution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations, rand);
     190        bestSolution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations, ApplyLinearScaling, rand);
    177191        trainRMSERow.Values.Add(bestSolution.TrainingRootMeanSquaredError);
    178192        testRMSERow.Values.Add(bestSolution.TestRootMeanSquaredError);
    179193        for (int r = 0; r < Restarts; r++) {
    180           var solution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations, rand);
     194          var solution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations, ApplyLinearScaling, rand);
    181195          trainRMSERow.Values.Add(solution.TrainingRootMeanSquaredError);
    182196          testRMSERow.Values.Add(solution.TestRootMeanSquaredError);
     
    186200        }
    187201      } else {
    188         bestSolution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations);
     202        bestSolution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations, ApplyLinearScaling);
    189203      }
    190204
     
    206220    /// <param name="random">Optional random number generator for random initialization of numeric constants.</param>
    207221    /// <returns></returns>
    208     public static ISymbolicRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData, string modelStructure, int maxIterations, IRandom rand = null) {
     222    public static ISymbolicRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData, string modelStructure, int maxIterations, bool applyLinearScaling, IRandom rand = null) {
    209223      var parser = new InfixExpressionParser();
    210224      var tree = parser.Parse(modelStructure);
     
    262276
    263277      SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, tree, problemData, problemData.TrainingIndices,
    264         applyLinearScaling: false, maxIterations: maxIterations,
     278        applyLinearScaling: applyLinearScaling, maxIterations: maxIterations,
    265279        updateVariableWeights: false, updateConstantsInTree: true);
    266280
    267       var scaledModel = new SymbolicRegressionModel(problemData.TargetVariable, tree, (ISymbolicDataAnalysisExpressionTreeInterpreter)interpreter.Clone());
    268       scaledModel.Scale(problemData);
    269       SymbolicRegressionSolution solution = new SymbolicRegressionSolution(scaledModel, (IRegressionProblemData)problemData.Clone());
     281      var model = new SymbolicRegressionModel(problemData.TargetVariable, tree, (ISymbolicDataAnalysisExpressionTreeInterpreter)interpreter.Clone());
     282      if (applyLinearScaling)
     283        model.Scale(problemData);
     284
     285      SymbolicRegressionSolution solution = new SymbolicRegressionSolution(model, (IRegressionProblemData)problemData.Clone());
    270286      solution.Model.Name = "Regression Model";
    271287      solution.Name = "Regression Solution";
Note: See TracChangeset for help on using the changeset viewer.