Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/16 19:42:40 (8 years ago)
Author:
gkronber
Message:

#1795: added OSGP for gradient boosting meta-learner

File:
1 edited

Legend:

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

    r13646 r13653  
    2626using System.Threading;
    2727using HeuristicLab.Analysis;
     28using HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm;
    2829using HeuristicLab.Common;
    2930using HeuristicLab.Core;
     
    3738using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
    3839using HeuristicLab.Random;
     40using HeuristicLab.Selection;
    3941
    4042namespace HeuristicLab.Algorithms.DataAnalysis.MctsSymbolicRegression {
     
    172174      Problem = new RegressionProblem(); // default problem
    173175      var mctsSymbReg = new MctsSymbolicRegressionAlgorithm();
    174       // var sgp = CreateSGP();
     176      mctsSymbReg.Iterations = 10000;
     177      mctsSymbReg.StoreAlgorithmInEachRun = false;
     178      var sgp = CreateOSGP();
    175179      var regressionAlgs = new ItemSet<IAlgorithm>(new IAlgorithm[] {
    176         new LinearRegression(), new RandomForestRegression(), new NearestNeighbourRegression(),
    177         // sgp,
     180        new RandomForestRegression(),
     181        sgp,
    178182        mctsSymbReg
    179183      });
     
    320324    }
    321325
    322     // this is probably slow as hell
     326
     327    private IAlgorithm CreateOSGP() {
     328      // configure strict osgp
     329      var alg = new OffspringSelectionGeneticAlgorithm.OffspringSelectionGeneticAlgorithm();
     330      var prob = new SymbolicRegressionSingleObjectiveProblem();
     331      prob.MaximumSymbolicExpressionTreeDepth.Value = 7;
     332      prob.MaximumSymbolicExpressionTreeLength.Value = 15;
     333      alg.Problem = prob;
     334      alg.SuccessRatio.Value = 1.0;
     335      alg.ComparisonFactorLowerBound.Value = 1.0;
     336      alg.ComparisonFactorUpperBound.Value = 1.0;
     337      alg.MutationProbability.Value = 0.15;
     338      alg.PopulationSize.Value = 200;
     339      alg.MaximumSelectionPressure.Value = 100;
     340      alg.MaximumEvaluatedSolutions.Value = 20000;
     341      alg.SelectorParameter.Value = alg.SelectorParameter.ValidValues.OfType<GenderSpecificSelector>().First();
     342      alg.MutatorParameter.Value = alg.MutatorParameter.ValidValues.OfType<MultiSymbolicExpressionTreeManipulator>().First();
     343      alg.StoreAlgorithmInEachRun = false;
     344      return alg;
     345    }
     346
    323347    private void SampleTrainingData(MersenneTwister rand, ModifiableDataset ds, int rRows,
    324348      IDataset sourceDs, double[] curTarget, string targetVarName, IEnumerable<int> trainingIndices) {
     
    374398        prob.ProblemDataParameter.Value = problemData;
    375399        return true;
    376       } else if (alg.Problem != null) {
    377         // a problem is set and it is not compatible
    378         return false;
    379       } else {
    380         try {
    381           // we try to use a symbolic regression problem (works for simple regression algs and GP)
    382           alg.Problem = new SymbolicRegressionSingleObjectiveProblem();
    383         } catch (Exception) {
    384           return false;
    385         }
    386         return true;
    387       }
     400      } else return false;
    388401    }
    389402
Note: See TracChangeset for help on using the changeset viewer.