Skip to content

Commit 38e03c4

Browse files
committed
Clean FastTree.cs and FastTreeArguments.cs following instructions in dotnet#2613
1 parent b70b424 commit 38e03c4

File tree

22 files changed

+252
-258
lines changed

22 files changed

+252
-258
lines changed

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

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

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

src/Microsoft.ML.FastTree/BoostingFastTree.cs

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

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

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

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

4949
if (FastTreeTrainerOptions.EnablePruning && !HasValidSet)
@@ -61,12 +61,12 @@ private protected override void CheckOptions(IChannel ch)
6161
private protected override TreeLearner ConstructTreeLearner(IChannel ch)
6262
{
6363
return new LeastSquaresRegressionTreeLearner(
64-
TrainSet, FastTreeTrainerOptions.NumLeaves, FastTreeTrainerOptions.MinDocumentsInLeafs, FastTreeTrainerOptions.EntropyCoefficient,
64+
TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.MinExampleCountPerLeaf, FastTreeTrainerOptions.EntropyCoefficient,
6565
FastTreeTrainerOptions.FeatureFirstUsePenalty, FastTreeTrainerOptions.FeatureReusePenalty, FastTreeTrainerOptions.SoftmaxTemperature,
66-
FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.RngSeed, FastTreeTrainerOptions.SplitFraction, FastTreeTrainerOptions.FilterZeroLambdas,
66+
FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.RandomSeed, FastTreeTrainerOptions.FeatureFractionPerSplit, FastTreeTrainerOptions.FilterZeroLambdas,
6767
FastTreeTrainerOptions.AllowEmptyTrees, FastTreeTrainerOptions.GainConfidenceLevel, FastTreeTrainerOptions.MaxCategoricalGroupsPerNode,
6868
FastTreeTrainerOptions.MaxCategoricalSplitPoints, BsrMaxTreeOutput(), ParallelTraining,
69-
FastTreeTrainerOptions.MinDocsPercentageForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinDocsForCategoricalSplit, FastTreeTrainerOptions.Bias);
69+
FastTreeTrainerOptions.MinExamplePercentageForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinExamplesForCategoricalSplit, FastTreeTrainerOptions.Bias);
7070
}
7171

7272
private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm(IChannel ch)
@@ -94,7 +94,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm(
9494
optimizationAlgorithm.ObjectiveFunction = ConstructObjFunc(ch);
9595
optimizationAlgorithm.Smoothing = FastTreeTrainerOptions.Smoothing;
9696
optimizationAlgorithm.DropoutRate = FastTreeTrainerOptions.DropoutRate;
97-
optimizationAlgorithm.DropoutRng = new Random(FastTreeTrainerOptions.RngSeed);
97+
optimizationAlgorithm.DropoutRng = new Random(FastTreeTrainerOptions.RandomSeed);
9898
optimizationAlgorithm.PreScoreUpdateEvent += PrintTestGraph;
9999

100100
return optimizationAlgorithm;

0 commit comments

Comments
 (0)