Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/29/16 17:16:44 (8 years ago)
Author:
mkommend
Message:

#2657: Changed nonlinear regression to perform at least one optimization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NonlinearRegression/NonlinearRegression.cs

    r14258 r14316  
    2121
    2222using System;
    23 using System.Collections.Generic;
    2423using System.Linq;
    2524using HeuristicLab.Common;
    2625using HeuristicLab.Core;
    2726using HeuristicLab.Data;
     27using HeuristicLab.Optimization;
    2828using HeuristicLab.Parameters;
    29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    30 using HeuristicLab.Optimization;
    3129using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3230using HeuristicLab.Problems.DataAnalysis;
     
    130128      if (SetSeedRandomly) Seed = (new System.Random()).Next();
    131129      var rand = new MersenneTwister((uint)Seed);
    132       IRegressionSolution bestSolution = null;
     130
     131      var bestSolution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations, rand);
    133132      for (int r = 0; r < Restarts; r++) {
    134133        var solution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations, rand);
    135         if (bestSolution == null || solution.TrainingRootMeanSquaredError < bestSolution.TrainingRootMeanSquaredError) {
     134        if (solution.TrainingRootMeanSquaredError < bestSolution.TrainingRootMeanSquaredError) {
    136135          bestSolution = solution;
    137136        }
     
    149148    /// The starting point for the numeric constants is initialized randomly if a random number generator is specified (~N(0,1)). Otherwise the user specified constants are
    150149    /// used as a starting point.
    151     /// </summary>
     150    /// </summary>-
    152151    /// <param name="problemData">Training and test data</param>
    153152    /// <param name="modelStructure">The function as infix expression</param>
Note: See TracChangeset for help on using the changeset viewer.