Skip to content

Commit d64a4ae

Browse files
committed
Clean FastTree.cs and FastTreeArguments.cs following instructions in #2613
1 parent 4eb9e45 commit d64a4ae

File tree

22 files changed

+292
-295
lines changed

22 files changed

+292
-295
lines changed

docs/samples/Microsoft.ML.Samples/Dynamic/FastTreeRegression.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@ public static void Example()
3535

3636
// Get the trained model parameters.
3737
var modelParams = model.LastTransformer.Model;
38-
39-
// Let's see where an example with Parity = 1 and Induced = 1 would end up in the single trained tree.
40-
var testRow = new VBuffer<float>(2, new[] { 1.0f, 1.0f });
41-
// Use the path object to pass to GetLeaf, which will populate path with the IDs of th nodes from root to leaf.
42-
List<int> path = default;
43-
// Get the ID of the leaf this example ends up in tree 0.
44-
var leafID = modelParams.GetLeaf(0, in testRow, ref path);
45-
// Get the leaf value for this leaf ID in tree 0.
46-
var leafValue = modelParams.GetLeafValue(0, leafID);
47-
Console.WriteLine("The leaf value in tree 0 is: " + leafValue);
4838
}
4939
}
5040
}

src/Microsoft.ML.FastTree/BoostingFastTree.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ private protected BoostingFastTreeTrainerBase(IHostEnvironment env,
2929
double learningRate)
3030
: base(env, label, featureColumn, weightColumn, groupIdColumn, numLeaves, numTrees, minDatapointsInLeaves)
3131
{
32-
FastTreeTrainerOptions.LearningRates = learningRate;
32+
FastTreeTrainerOptions.LearningRate = learningRate;
3333
}
3434

3535
private protected override void CheckOptions(IChannel ch)
@@ -42,10 +42,10 @@ private protected override void CheckOptions(IChannel ch)
4242
if (FastTreeTrainerOptions.CompressEnsemble && FastTreeTrainerOptions.WriteLastEnsemble)
4343
throw ch.Except("Ensemble compression cannot be done when forcing to write last ensemble (hl)");
4444

45-
if (FastTreeTrainerOptions.NumLeaves > 2 && FastTreeTrainerOptions.HistogramPoolSize > FastTreeTrainerOptions.NumLeaves - 1)
45+
if (FastTreeTrainerOptions.NumberOfLeaves > 2 && FastTreeTrainerOptions.HistogramPoolSize > FastTreeTrainerOptions.NumberOfLeaves - 1)
4646
throw ch.Except("Histogram pool size (ps) must be at least 2.");
4747

48-
if (FastTreeTrainerOptions.NumLeaves > 2 && FastTreeTrainerOptions.HistogramPoolSize > FastTreeTrainerOptions.NumLeaves - 1)
48+
if (FastTreeTrainerOptions.NumberOfLeaves > 2 && FastTreeTrainerOptions.HistogramPoolSize > FastTreeTrainerOptions.NumberOfLeaves - 1)
4949
throw ch.Except("Histogram pool size (ps) must be at most numLeaves - 1.");
5050

5151
if (FastTreeTrainerOptions.EnablePruning && !HasValidSet)
@@ -63,12 +63,12 @@ private protected override void CheckOptions(IChannel ch)
6363
private protected override TreeLearner ConstructTreeLearner(IChannel ch)
6464
{
6565
return new LeastSquaresRegressionTreeLearner(
66-
TrainSet, FastTreeTrainerOptions.NumLeaves, FastTreeTrainerOptions.MinDocumentsInLeafs, FastTreeTrainerOptions.EntropyCoefficient,
66+
TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.MinExampleCountPerLeaf, FastTreeTrainerOptions.EntropyCoefficient,
6767
FastTreeTrainerOptions.FeatureFirstUsePenalty, FastTreeTrainerOptions.FeatureReusePenalty, FastTreeTrainerOptions.SoftmaxTemperature,
68-
FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.RngSeed, FastTreeTrainerOptions.SplitFraction, FastTreeTrainerOptions.FilterZeroLambdas,
68+
FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.RandomSeed, FastTreeTrainerOptions.FeatureFractionPerSplit, FastTreeTrainerOptions.FilterZeroLambdas,
6969
FastTreeTrainerOptions.AllowEmptyTrees, FastTreeTrainerOptions.GainConfidenceLevel, FastTreeTrainerOptions.MaxCategoricalGroupsPerNode,
7070
FastTreeTrainerOptions.MaxCategoricalSplitPoints, BsrMaxTreeOutput(), ParallelTraining,
71-
FastTreeTrainerOptions.MinDocsPercentageForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinDocsForCategoricalSplit, FastTreeTrainerOptions.Bias);
71+
FastTreeTrainerOptions.MinExamplePercentageForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinExamplesForCategoricalSplit, FastTreeTrainerOptions.Bias);
7272
}
7373

7474
private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm(IChannel ch)
@@ -96,7 +96,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm(
9696
optimizationAlgorithm.ObjectiveFunction = ConstructObjFunc(ch);
9797
optimizationAlgorithm.Smoothing = FastTreeTrainerOptions.Smoothing;
9898
optimizationAlgorithm.DropoutRate = FastTreeTrainerOptions.DropoutRate;
99-
optimizationAlgorithm.DropoutRng = new Random(FastTreeTrainerOptions.RngSeed);
99+
optimizationAlgorithm.DropoutRng = new Random(FastTreeTrainerOptions.RandomSeed);
100100
optimizationAlgorithm.PreScoreUpdateEvent += PrintTestGraph;
101101

102102
return optimizationAlgorithm;

0 commit comments

Comments
 (0)