Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12661


Ignore:
Timestamp:
07/07/15 17:58:01 (9 years ago)
Author:
gkronber
Message:

#2261: regression tree builder should not be used from outside (made internal)

Location:
branches/GBT-trunkintegration
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/GBT-trunkintegration/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesAlgorithmStatic.cs

    r12635 r12661  
    118118
    119119    // simple interface
    120     public static IRegressionSolution TrainGbm(IRegressionProblemData problemData, int maxSize, double nu, double r, int maxIterations) {
    121       return TrainGbm(problemData, new SquaredErrorLoss(), maxSize, nu, r, maxIterations);
    122     }
    123 
    124     // simple interface
    125     public static IRegressionSolution TrainGbm(IRegressionProblemData problemData, ILossFunction lossFunction,
    126       int maxSize, double nu, double r, int maxIterations, uint randSeed = 31415) {
     120    public static IRegressionSolution TrainGbm(IRegressionProblemData problemData, ILossFunction lossFunction, int maxSize, double nu, double r, double m, int maxIterations, uint randSeed = 31415) {
    127121      Contract.Assert(r > 0);
    128122      Contract.Assert(r <= 1.0);
     
    133127      state.maxSize = maxSize;
    134128      state.r = r;
     129      state.m = m;
    135130      state.nu = nu;
    136131
  • branches/GBT-trunkintegration/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/RegressionTreeBuilder.cs

    r12658 r12661  
    3636  // pre-calculated so that optimal thresholds for splits can be calculated in O(n) for each input variable.
    3737  // After each split the row idx are partitioned in a left an right part.
    38   public class RegressionTreeBuilder {
     38  internal class RegressionTreeBuilder {
    3939    private readonly IRandom random;
    4040    private readonly IRegressionProblemData problemData;
  • branches/GBT-trunkintegration/Tests/Test.cs

    r12658 r12661  
    7676          {-1.5, 20,  1},
    7777          {-1.5, 20, -1},
    78           {0.5, 20, -1},
     78          {-0.5, 20, -1},
    7979          {0.5, 10, -1},
    8080          {1.5, 10, -1},
     
    257257
    258258    #region helper
    259     private void BuildTree(double[,] xy, string[] allVariables, int maxDepth) {
     259    private void BuildTree(double[,] xy, string[] allVariables, int maxSize) {
    260260      int nRows = xy.GetLength(0);
    261261      var allowedInputs = allVariables.Skip(1);
     
    266266      problemData.TestPartition.Start = nRows;
    267267      problemData.TestPartition.End = nRows;
    268       var rand = new MersenneTwister(31415);
    269       var builder = new RegressionTreeBuilder(problemData, rand);
    270       var model = (GradientBoostedTreesModel)builder.CreateRegressionTree(maxDepth, 1, 1); // maximal depth and use all rows and cols
     268      var solution = GradientBoostedTreesAlgorithmStatic.TrainGbm(problemData, new SquaredErrorLoss(), maxSize, nu: 1, r: 1, m: 1, maxIterations: 1, randSeed: 31415);
     269      var model = (GradientBoostedTreesModel)solution.Model;
    271270      var treeM = model.Models.Skip(1).First() as RegressionTreeModel;
    272271
Note: See TracChangeset for help on using the changeset viewer.