Changeset 12661
- Timestamp:
- 07/07/15 17:58:01 (9 years ago)
- Location:
- branches/GBT-trunkintegration
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GBT-trunkintegration/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesAlgorithmStatic.cs
r12635 r12661 118 118 119 119 // 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) { 127 121 Contract.Assert(r > 0); 128 122 Contract.Assert(r <= 1.0); … … 133 127 state.maxSize = maxSize; 134 128 state.r = r; 129 state.m = m; 135 130 state.nu = nu; 136 131 -
branches/GBT-trunkintegration/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/RegressionTreeBuilder.cs
r12658 r12661 36 36 // pre-calculated so that optimal thresholds for splits can be calculated in O(n) for each input variable. 37 37 // After each split the row idx are partitioned in a left an right part. 38 publicclass RegressionTreeBuilder {38 internal class RegressionTreeBuilder { 39 39 private readonly IRandom random; 40 40 private readonly IRegressionProblemData problemData; -
branches/GBT-trunkintegration/Tests/Test.cs
r12658 r12661 76 76 {-1.5, 20, 1}, 77 77 {-1.5, 20, -1}, 78 { 0.5, 20, -1},78 {-0.5, 20, -1}, 79 79 {0.5, 10, -1}, 80 80 {1.5, 10, -1}, … … 257 257 258 258 #region helper 259 private void BuildTree(double[,] xy, string[] allVariables, int max Depth) {259 private void BuildTree(double[,] xy, string[] allVariables, int maxSize) { 260 260 int nRows = xy.GetLength(0); 261 261 var allowedInputs = allVariables.Skip(1); … … 266 266 problemData.TestPartition.Start = nRows; 267 267 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; 271 270 var treeM = model.Models.Skip(1).First() as RegressionTreeModel; 272 271
Note: See TracChangeset
for help on using the changeset viewer.