From 38e03c4614477b2a63da28232d7738c434268e4a Mon Sep 17 00:00:00 2001 From: Wei-Sheng Chin Date: Tue, 26 Feb 2019 17:33:40 -0800 Subject: [PATCH 01/12] Clean FastTree.cs and FastTreeArguments.cs following instructions in #2613 --- .../Dynamic/FastTreeRegression.cs | 10 -- src/Microsoft.ML.FastTree/BoostingFastTree.cs | 14 +- src/Microsoft.ML.FastTree/FastTree.cs | 136 +++++++++--------- .../FastTreeArguments.cs | 128 ++++++++--------- .../FastTreeClassification.cs | 18 +-- src/Microsoft.ML.FastTree/FastTreeRanking.cs | 22 +-- .../FastTreeRegression.cs | 14 +- src/Microsoft.ML.FastTree/FastTreeTweedie.cs | 14 +- src/Microsoft.ML.FastTree/RandomForest.cs | 8 +- .../RandomForestClassification.cs | 8 +- .../RandomForestRegression.cs | 6 +- .../TreeTrainersCatalog.cs | 44 +++--- .../TreeTrainersStatic.cs | 24 ++-- .../Algorithms/SmacSweeper.cs | 4 +- .../UnitTests/TestEntryPoints.cs | 4 +- .../Evaluation.cs | 4 +- .../Validation.cs | 2 +- .../TestPredictors.cs | 12 +- .../TreeRepresentation.cs | 14 +- test/Microsoft.ML.Tests/Scenarios/OvaTest.cs | 2 +- .../TreeEnsembleFeaturizerTest.cs | 6 +- .../TrainerEstimators/TreeEstimators.cs | 16 +-- 22 files changed, 252 insertions(+), 258 deletions(-) diff --git a/docs/samples/Microsoft.ML.Samples/Dynamic/FastTreeRegression.cs b/docs/samples/Microsoft.ML.Samples/Dynamic/FastTreeRegression.cs index 546de0640c..b40d398165 100644 --- a/docs/samples/Microsoft.ML.Samples/Dynamic/FastTreeRegression.cs +++ b/docs/samples/Microsoft.ML.Samples/Dynamic/FastTreeRegression.cs @@ -36,16 +36,6 @@ public static void Example() // Get the trained model parameters. var modelParams = model.LastTransformer.Model; - - // Let's see where an example with Parity = 1 and Induced = 1 would end up in the single trained tree. - var testRow = new VBuffer(2, new[] { 1.0f, 1.0f }); - // Use the path object to pass to GetLeaf, which will populate path with the IDs of th nodes from root to leaf. - List path = default; - // Get the ID of the leaf this example ends up in tree 0. - var leafID = modelParams.GetLeaf(0, in testRow, ref path); - // Get the leaf value for this leaf ID in tree 0. - var leafValue = modelParams.GetLeafValue(0, leafID); - Console.WriteLine("The leaf value in tree 0 is: " + leafValue); } } } diff --git a/src/Microsoft.ML.FastTree/BoostingFastTree.cs b/src/Microsoft.ML.FastTree/BoostingFastTree.cs index 0281b8ab88..27b341d62a 100644 --- a/src/Microsoft.ML.FastTree/BoostingFastTree.cs +++ b/src/Microsoft.ML.FastTree/BoostingFastTree.cs @@ -27,7 +27,7 @@ private protected BoostingFastTreeTrainerBase(IHostEnvironment env, double learningRate) : base(env, label, featureColumn, weightColumn, groupIdColumn, numLeaves, numTrees, minDatapointsInLeaves) { - FastTreeTrainerOptions.LearningRates = learningRate; + FastTreeTrainerOptions.LearningRate = learningRate; } private protected override void CheckOptions(IChannel ch) @@ -40,10 +40,10 @@ private protected override void CheckOptions(IChannel ch) if (FastTreeTrainerOptions.CompressEnsemble && FastTreeTrainerOptions.WriteLastEnsemble) throw ch.Except("Ensemble compression cannot be done when forcing to write last ensemble (hl)"); - if (FastTreeTrainerOptions.NumLeaves > 2 && FastTreeTrainerOptions.HistogramPoolSize > FastTreeTrainerOptions.NumLeaves - 1) + if (FastTreeTrainerOptions.NumberOfLeaves > 2 && FastTreeTrainerOptions.HistogramPoolSize > FastTreeTrainerOptions.NumberOfLeaves - 1) throw ch.Except("Histogram pool size (ps) must be at least 2."); - if (FastTreeTrainerOptions.NumLeaves > 2 && FastTreeTrainerOptions.HistogramPoolSize > FastTreeTrainerOptions.NumLeaves - 1) + if (FastTreeTrainerOptions.NumberOfLeaves > 2 && FastTreeTrainerOptions.HistogramPoolSize > FastTreeTrainerOptions.NumberOfLeaves - 1) throw ch.Except("Histogram pool size (ps) must be at most numLeaves - 1."); if (FastTreeTrainerOptions.EnablePruning && !HasValidSet) @@ -61,12 +61,12 @@ private protected override void CheckOptions(IChannel ch) private protected override TreeLearner ConstructTreeLearner(IChannel ch) { return new LeastSquaresRegressionTreeLearner( - TrainSet, FastTreeTrainerOptions.NumLeaves, FastTreeTrainerOptions.MinDocumentsInLeafs, FastTreeTrainerOptions.EntropyCoefficient, + TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.MinExampleCountPerLeaf, FastTreeTrainerOptions.EntropyCoefficient, FastTreeTrainerOptions.FeatureFirstUsePenalty, FastTreeTrainerOptions.FeatureReusePenalty, FastTreeTrainerOptions.SoftmaxTemperature, - FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.RngSeed, FastTreeTrainerOptions.SplitFraction, FastTreeTrainerOptions.FilterZeroLambdas, + FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.RandomSeed, FastTreeTrainerOptions.FeatureFractionPerSplit, FastTreeTrainerOptions.FilterZeroLambdas, FastTreeTrainerOptions.AllowEmptyTrees, FastTreeTrainerOptions.GainConfidenceLevel, FastTreeTrainerOptions.MaxCategoricalGroupsPerNode, FastTreeTrainerOptions.MaxCategoricalSplitPoints, BsrMaxTreeOutput(), ParallelTraining, - FastTreeTrainerOptions.MinDocsPercentageForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinDocsForCategoricalSplit, FastTreeTrainerOptions.Bias); + FastTreeTrainerOptions.MinExamplePercentageForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinExamplesForCategoricalSplit, FastTreeTrainerOptions.Bias); } private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm(IChannel ch) @@ -94,7 +94,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm( optimizationAlgorithm.ObjectiveFunction = ConstructObjFunc(ch); optimizationAlgorithm.Smoothing = FastTreeTrainerOptions.Smoothing; optimizationAlgorithm.DropoutRate = FastTreeTrainerOptions.DropoutRate; - optimizationAlgorithm.DropoutRng = new Random(FastTreeTrainerOptions.RngSeed); + optimizationAlgorithm.DropoutRng = new Random(FastTreeTrainerOptions.RandomSeed); optimizationAlgorithm.PreScoreUpdateEvent += PrintTestGraph; return optimizationAlgorithm; diff --git a/src/Microsoft.ML.FastTree/FastTree.cs b/src/Microsoft.ML.FastTree/FastTree.cs index f27a46eaa5..83f20f55b8 100644 --- a/src/Microsoft.ML.FastTree/FastTree.cs +++ b/src/Microsoft.ML.FastTree/FastTree.cs @@ -113,9 +113,9 @@ private protected FastTreeTrainerBase(IHostEnvironment env, // set up the directly provided values // override with the directly provided values. - FastTreeTrainerOptions.NumLeaves = numLeaves; - FastTreeTrainerOptions.NumTrees = numTrees; - FastTreeTrainerOptions.MinDocumentsInLeafs = minDatapointsInLeaves; + FastTreeTrainerOptions.NumberOfLeaves = numLeaves; + FastTreeTrainerOptions.NumberOfTrees = numTrees; + FastTreeTrainerOptions.MinExampleCountPerLeaf = minDatapointsInLeaves; FastTreeTrainerOptions.LabelColumnName = label.Name; FastTreeTrainerOptions.FeatureColumnName = featureColumn; @@ -176,7 +176,7 @@ private protected virtual float GetMaxLabel() private void Initialize(IHostEnvironment env) { - int numThreads = FastTreeTrainerOptions.NumThreads ?? Environment.ProcessorCount; + int numThreads = FastTreeTrainerOptions.NumberOfThreads ?? Environment.ProcessorCount; if (Host.ConcurrencyFactor > 0 && numThreads > Host.ConcurrencyFactor) { using (var ch = Host.Start("FastTreeTrainerBase")) @@ -198,7 +198,7 @@ private protected void ConvertData(RoleMappedData trainData) { AnnotationUtils.TryGetCategoricalFeatureIndices(trainData.Schema.Schema, trainData.Schema.Feature.Value.Index, out CategoricalFeatures); var useTranspose = UseTranspose(FastTreeTrainerOptions.DiskTranspose, trainData) && (ValidData == null || UseTranspose(FastTreeTrainerOptions.DiskTranspose, ValidData)); - var instanceConverter = new ExamplesToFastTreeBins(Host, FastTreeTrainerOptions.MaxBins, useTranspose, !FastTreeTrainerOptions.FeatureFlocks, FastTreeTrainerOptions.MinDocumentsInLeafs, GetMaxLabel()); + var instanceConverter = new ExamplesToFastTreeBins(Host, FastTreeTrainerOptions.MaxBinCountPerFeature, useTranspose, !FastTreeTrainerOptions.FeatureFlocks, FastTreeTrainerOptions.MinExampleCountPerLeaf, GetMaxLabel()); TrainSet = instanceConverter.FindBinsAndReturnDataset(trainData, PredictionKind, ParallelTraining, CategoricalFeatures, FastTreeTrainerOptions.CategoricalSplit); FeatureMap = instanceConverter.FeatureMap; @@ -270,14 +270,14 @@ private protected virtual void CheckOptions(IChannel ch) // change arguments if (FastTreeTrainerOptions.HistogramPoolSize < 2) - FastTreeTrainerOptions.HistogramPoolSize = FastTreeTrainerOptions.NumLeaves * 2 / 3; - if (FastTreeTrainerOptions.HistogramPoolSize > FastTreeTrainerOptions.NumLeaves - 1) - FastTreeTrainerOptions.HistogramPoolSize = FastTreeTrainerOptions.NumLeaves - 1; + FastTreeTrainerOptions.HistogramPoolSize = FastTreeTrainerOptions.NumberOfLeaves * 2 / 3; + if (FastTreeTrainerOptions.HistogramPoolSize > FastTreeTrainerOptions.NumberOfLeaves - 1) + FastTreeTrainerOptions.HistogramPoolSize = FastTreeTrainerOptions.NumberOfLeaves - 1; if (FastTreeTrainerOptions.BaggingSize > 0) { - int bagCount = FastTreeTrainerOptions.NumTrees / FastTreeTrainerOptions.BaggingSize; - if (bagCount * FastTreeTrainerOptions.BaggingSize != FastTreeTrainerOptions.NumTrees) + int bagCount = FastTreeTrainerOptions.NumberOfTrees / FastTreeTrainerOptions.BaggingSize; + if (bagCount * FastTreeTrainerOptions.BaggingSize != FastTreeTrainerOptions.NumberOfTrees) throw ch.Except("Number of trees should be a multiple of number bag size"); } @@ -423,7 +423,7 @@ private protected bool[] GetActiveFeatures() if (FastTreeTrainerOptions.FeatureFraction < 1.0) { if (_featureSelectionRandom == null) - _featureSelectionRandom = new Random(FastTreeTrainerOptions.FeatureSelectSeed); + _featureSelectionRandom = new Random(FastTreeTrainerOptions.FeatureSelectionRandomSeed); for (int i = 0; i < TrainSet.NumFeatures; ++i) { @@ -593,7 +593,7 @@ private void GenerateActiveFeatureLists(int numberOfItems) private protected virtual BaggingProvider CreateBaggingProvider() { Contracts.Assert(FastTreeTrainerOptions.BaggingSize > 0); - return new BaggingProvider(TrainSet, FastTreeTrainerOptions.NumLeaves, FastTreeTrainerOptions.RngSeed, FastTreeTrainerOptions.BaggingTrainFraction); + return new BaggingProvider(TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.RandomSeed, FastTreeTrainerOptions.BaggingExampleFraction); } private protected virtual bool ShouldRandomStartOptimizer() @@ -604,7 +604,7 @@ private protected virtual bool ShouldRandomStartOptimizer() private protected virtual void Train(IChannel ch) { Contracts.AssertValue(ch); - int numTotalTrees = FastTreeTrainerOptions.NumTrees; + int numTotalTrees = FastTreeTrainerOptions.NumberOfTrees; ch.Info( "Reserved memory for tree learner: {0} bytes", @@ -624,7 +624,7 @@ private protected virtual void Train(IChannel ch) if (Ensemble.NumTrees < numTotalTrees && ShouldRandomStartOptimizer()) { ch.Info("Randomizing start point"); - OptimizationAlgorithm.TrainingScores.RandomizeScores(FastTreeTrainerOptions.RngSeed, false); + OptimizationAlgorithm.TrainingScores.RandomizeScores(FastTreeTrainerOptions.RandomSeed, false); revertRandomStart = true; } @@ -711,7 +711,7 @@ private protected virtual void Train(IChannel ch) { revertRandomStart = false; ch.Info("Reverting random score assignment"); - OptimizationAlgorithm.TrainingScores.RandomizeScores(FastTreeTrainerOptions.RngSeed, true); + OptimizationAlgorithm.TrainingScores.RandomizeScores(FastTreeTrainerOptions.RandomSeed, true); } #if !NO_STORE @@ -796,7 +796,7 @@ private protected virtual void PrintIterationMessage(IChannel ch, IProgressChann private protected virtual void PrintTestResults(IChannel ch) { - if (FastTreeTrainerOptions.TestFrequency != int.MaxValue && (Ensemble.NumTrees % FastTreeTrainerOptions.TestFrequency == 0 || Ensemble.NumTrees == FastTreeTrainerOptions.NumTrees)) + if (FastTreeTrainerOptions.TestFrequency != int.MaxValue && (Ensemble.NumTrees % FastTreeTrainerOptions.TestFrequency == 0 || Ensemble.NumTrees == FastTreeTrainerOptions.NumberOfTrees)) { var sb = new StringBuilder(); using (var sw = new StringWriter(sb)) @@ -902,7 +902,7 @@ internal abstract class DataConverter /// in this array are initialized to non-null values but it must happen at least no later /// than immediately after we return from . /// - public readonly Double[][] BinUpperBounds; + public readonly double[][] BinUpperBounds; /// /// In the event that any features are filtered, this will contain the feature map, where @@ -927,7 +927,7 @@ private protected bool UsingMaxLabel get { return MaxLabel != float.PositiveInfinity; } } - private DataConverter(RoleMappedData data, IHost host, Double[][] binUpperBounds, float maxLabel, + private DataConverter(RoleMappedData data, IHost host, double[][] binUpperBounds, float maxLabel, PredictionKind kind, int[] categoricalFeatureIndices, bool categoricalSplit) { Contracts.AssertValue(host, "host"); @@ -946,7 +946,7 @@ private DataConverter(RoleMappedData data, IHost host, Double[][] binUpperBounds BinUpperBounds = binUpperBounds; } else - BinUpperBounds = new Double[NumFeatures][]; + BinUpperBounds = new double[NumFeatures][]; MaxLabel = maxLabel; PredictionKind = kind; CategoricalSplit = categoricalSplit; @@ -972,7 +972,7 @@ public static DataConverter Create(RoleMappedData data, IHost host, int maxBins, return conv; } - public static DataConverter Create(RoleMappedData data, IHost host, Double[][] binUpperBounds, + public static DataConverter Create(RoleMappedData data, IHost host, double[][] binUpperBounds, float maxLabel, bool diskTranspose, bool noFlocks, PredictionKind kind, int[] categoricalFeatureIndices, bool categoricalSplit) { Contracts.AssertValue(host, "host"); @@ -1025,7 +1025,7 @@ private protected static bool CalculateBins(BinFinder binFinder, in VBuffer> NonZeroBinnedValuesForSparse(ReadOnlySpan values, ReadOnlySpan indices, Double[] binUpperBounds) + private static IEnumerable> NonZeroBinnedValuesForSparse(ReadOnlySpan values, ReadOnlySpan indices, double[] binUpperBounds) { Contracts.Assert(values.Length == indices.Length); Contracts.Assert(Algorithms.FindFirstGE(binUpperBounds, 0) == 0); @@ -1093,12 +1093,12 @@ private FeatureFlockBase CreateOneHotFlock(IChannel ch, ch.Assert(min <= fi && fi < lim); int subfeature = f2sf[fi - min]; ch.Assert(subfeature >= 0); - Double val = ind[subfeature, i]; + double val = ind[subfeature, i]; #if false // Same note, too slow even for debug builds. // Assert that all the other features really would be cold for this position. Contracts.Assert(Enumerable.Range(min, fi - min).Concat(Enumerable.Range(fi + 1, lim - (fi + 1))).All(f => ind[f, i] < BinUpperBounds[f][0])); #endif - Double[] bub = BinUpperBounds[fi]; + double[] bub = BinUpperBounds[fi]; ch.Assert(bub.Length > 1); int bin = Algorithms.FindFirstGE(bub, val); ch.Assert(0 < bin && bin < bub.Length); // If 0, should not have been considered "on", so what the heck? @@ -1172,7 +1172,7 @@ private FeatureFlockBase CreateOneHotFlockCategorical(IChannel ch, // Assert that all the other features really would be cold for this position. Contracts.Assert(Enumerable.Range(min, fi - min).Concat(Enumerable.Range(fi + 1, lim - (fi + 1))).All(f => ind[f, i] < BinUpperBounds[f][0])); #endif - Double[] bub = BinUpperBounds[fi]; + double[] bub = BinUpperBounds[fi]; ch.Assert(bub.Length == 2); //REVIEW: leaving out check for the value to reduced memory consuption and going with //leap of faith based on what the user told. @@ -1207,7 +1207,7 @@ private FeatureFlockBase CreateOneHotFlockCategorical(IChannel ch, /// The upper bounds of the binning of this feature. /// A derived binned derived feature vector. private protected static SingletonFeatureFlock CreateSingletonFlock(IChannel ch, in VBuffer values, int[] binnedValues, - Double[] binUpperBounds) + double[] binUpperBounds) { Contracts.AssertValue(ch); ch.Assert(Utils.Size(binUpperBounds) > 0); @@ -1419,7 +1419,7 @@ private Dataset Construct(RoleMappedData examples, ref int numExamples, int maxB // Perhaps we should change the binning to just work over singles. VBuffer doubleTemp = default(VBuffer); - var copier = GetCopier(NumberDataViewType.Single, NumberDataViewType.Double); + var copier = GetCopier(NumberDataViewType.Single, NumberDataViewType.Double); int iFeature = 0; pch.SetHeader(new ProgressHeader("features"), e => e.SetProgress(0, iFeature, features.Length)); while (cursor.MoveNext()) @@ -1488,7 +1488,7 @@ private Dataset Construct(RoleMappedData examples, ref int numExamples, int maxB VBuffer doubleTemp = default(VBuffer); int[] binnedValues = new int[numExamples]; - var copier = GetCopier(NumberDataViewType.Single, NumberDataViewType.Double); + var copier = GetCopier(NumberDataViewType.Single, NumberDataViewType.Double); int iFeature = 0; if (CategoricalSplit && CategoricalFeatureIndices != null) { @@ -1508,7 +1508,7 @@ private Dataset Construct(RoleMappedData examples, ref int numExamples, int maxB iFeatureLocal <= CategoricalFeatureIndices[catRangeIndex + 1]; ++iFeatureLocal) { - Double[] bup = BinUpperBounds[iFeatureLocal]; + double[] bup = BinUpperBounds[iFeatureLocal]; if (bup.Length == 1) { // This is a trivial feature. Skip it. @@ -1516,7 +1516,7 @@ private Dataset Construct(RoleMappedData examples, ref int numExamples, int maxB } Contracts.Assert(Utils.Size(bup) > 0); - Double firstBin = bup[0]; + double firstBin = bup[0]; GetFeatureValues(catCursor, iFeatureLocal, catGetter, ref temp, ref doubleTemp, copier); bool add = false; var doubleTempValues = doubleTemp.GetValues(); @@ -1594,7 +1594,7 @@ private Dataset Construct(RoleMappedData examples, ref int numExamples, int maxB // Construct the labels. short[] ratings = new short[numExamples]; - Double[] actualLabels = new Double[numExamples]; + double[] actualLabels = new double[numExamples]; if (labelIdx >= 0) { @@ -1610,7 +1610,7 @@ private Dataset Construct(RoleMappedData examples, ref int numExamples, int maxB if (UsingMaxLabel && !(0 <= label && label <= MaxLabel)) throw Host.Except("Found invalid label {0}. Value should be between 0 and {1}, inclusive.", label, MaxLabel); ratings[ii] = (short)label; - actualLabels[ii] = (Double)label; + actualLabels[ii] = (double)label; } } @@ -1818,7 +1818,7 @@ private void MakeBoundariesAndCheckLabels(out long missingInstances, out long to { long featureValues = 0; // Warn at about 2 GB usage. - const long featureValuesWarnThreshold = (2L << 30) / sizeof(Double); + const long featureValuesWarnThreshold = (2L << 30) / sizeof(double); bool featureValuesWarned = false; const string featureValuesWarning = "We seem to be processing a lot of data. Consider using the FastTree diskTranspose+ (or dt+) option, for slower but more memory efficient transposition."; const int queryChunkSize = 100; @@ -1827,7 +1827,7 @@ private void MakeBoundariesAndCheckLabels(out long missingInstances, out long to ch.Info("Changing data from row-wise to column-wise"); long pos = 0; - double rowCountDbl = (double?)_data.Data.GetRowCount() ?? Double.NaN; + double rowCountDbl = (double?)_data.Data.GetRowCount() ?? double.NaN; pch.SetHeader(new ProgressHeader("examples"), e => e.SetProgress(0, pos, rowCountDbl)); // REVIEW: Should we ignore rows with bad label, weight, or group? The previous code seemed to let @@ -2122,7 +2122,7 @@ private IEnumerable CreateFlocksCore(IChannel ch, IProgressCha iFeatureLocal <= CategoricalFeatureIndices[catRangeIndex + 1]; ++iFeatureLocal) { - Double[] bup = BinUpperBounds[iFeatureLocal]; + double[] bup = BinUpperBounds[iFeatureLocal]; if (bup.Length == 1) { // This is a trivial feature. Skip it. @@ -2130,7 +2130,7 @@ private IEnumerable CreateFlocksCore(IChannel ch, IProgressCha } Contracts.Assert(Utils.Size(bup) > 0); - Double firstBin = bup[0]; + double firstBin = bup[0]; using (IEnumerator hotEnumerator = _instanceList[iFeatureLocal].AllIndicesGT(NumExamples, firstBin).GetEnumerator()) { while (hotEnumerator.MoveNext()) @@ -2240,7 +2240,7 @@ private IEnumerable CreateFlocksCore(IChannel ch, IProgressCha for (; iFeature < featureLim; ++iFeature) { - Double[] bup = BinUpperBounds[iFeature]; + double[] bup = BinUpperBounds[iFeature]; Contracts.Assert(Utils.Size(bup) > 0); if (bup.Length == 1) { @@ -2263,7 +2263,7 @@ private IEnumerable CreateFlocksCore(IChannel ch, IProgressCha yield return createFlock(); } countBins += bup.Length - 1; - Double firstBin = bup[0]; + double firstBin = bup[0]; int localHotRows = 0; // The number of bits we would use if we incorporated the current feature in to the // existing running flock. @@ -2378,24 +2378,23 @@ private Dataset.DatasetSkeleton CreateDatasetSkeleton() } } - // REVIEW: Change this, as well as the bin finding code and bin upper bounds, to be float instead of Double. - + // REVIEW: Change this, as well as the bin finding code and bin upper bounds, to be float instead of double. /// /// A mutable list of index,value that may be kept sparse or dense. /// private sealed class ValuesList { private bool _isSparse; - private List _dense; + private List _dense; private int _nonZeroElements; // when dense, is the number of non-zero elements (for determining when to sparsify) - private List> _sparse; + private List> _sparse; public ValuesList() { - _dense = new List(); + _dense = new List(); } - public void Add(int index, Double value) + public void Add(int index, double value) { if (!_isSparse) { @@ -2406,7 +2405,7 @@ public void Add(int index, Double value) { // Add zeros if needed. while (_dense.Count < index) - _dense.Add(default(Double)); + _dense.Add(default(double)); // Add the value. _dense.Add(value); if (value != 0) @@ -2417,7 +2416,7 @@ public void Add(int index, Double value) // Note this also may happen because we just sparsified. Contracts.Assert(_isSparse); if (value != 0) - _sparse.Add(new KeyValuePair(index, value)); + _sparse.Add(new KeyValuePair(index, value)); } private bool ShouldSparsify(int nonZeroElements, int totalElements) @@ -2428,11 +2427,11 @@ private bool ShouldSparsify(int nonZeroElements, int totalElements) private void Sparsify() { - _sparse = new List>(_nonZeroElements); + _sparse = new List>(_nonZeroElements); for (int i = 0; i < _dense.Count; i++) { if (_dense[i] != 0) - _sparse.Add(new KeyValuePair(i, _dense[i])); + _sparse.Add(new KeyValuePair(i, _dense[i])); } _isSparse = true; _dense = null; @@ -2446,7 +2445,7 @@ private void Sparsify() /// comparison is made /// The count of all indices in the range of 0 to /// exclusive whose values are greater than - public int CountIndicesGT(int length, Double gtValue) + public int CountIndicesGT(int length, double gtValue) { Contracts.Assert(0 <= length); if (_isSparse) @@ -2470,7 +2469,7 @@ public int CountIndicesGT(int length, Double gtValue) /// All indices in the range of 0 to exclusive /// whose values are greater than , in /// increasing order - public IEnumerable AllIndicesGT(int lim, Double gtValue) + public IEnumerable AllIndicesGT(int lim, double gtValue) { Contracts.Assert(0 <= lim); if (_isSparse) @@ -2520,7 +2519,7 @@ public IEnumerable AllIndicesGT(int lim, Double gtValue) } } - public void CopyTo(int length, ref VBuffer dst) + public void CopyTo(int length, ref VBuffer dst) { Contracts.Assert(0 <= length); VBufferEditor editor; @@ -2653,7 +2652,7 @@ public sealed class ForwardIndexer /// it is OK to access [1, 5], then [0, 5], but once this is done you cannot /// access the same feature at the same position. /// - public Double this[int featureIndex, int rowIndex] + public double this[int featureIndex, int rowIndex] { get { @@ -2821,10 +2820,12 @@ public abstract class TreeEnsembleModelParameters : private protected abstract uint VerCategoricalSplitSerialized { get; } + [BestFriend] internal readonly DataViewType InputType; DataViewType IValueMapper.InputType => InputType; - protected readonly DataViewType OutputType; + [BestFriend] + internal readonly DataViewType OutputType; DataViewType IValueMapper.OutputType => OutputType; bool ICanSavePfa.CanSavePfa => true; @@ -3142,26 +3143,26 @@ void ICanSaveSummary.SaveSummary(TextWriter writer, RoleMappedSchema schema) foreach (var pair in ((ICanGetSummaryInKeyValuePairs)this).GetSummaryInKeyValuePairs(schema)) { - Host.Assert(pair.Value is Double); - writer.WriteLine("\t{0}\t{1}", pair.Key, (Double)pair.Value); + Host.Assert(pair.Value is double); + writer.WriteLine("\t{0}\t{1}", pair.Key, (double)pair.Value); } } - private IEnumerable> GetSortedFeatureGains(RoleMappedSchema schema) + private IEnumerable> GetSortedFeatureGains(RoleMappedSchema schema) { var gainMap = new FeatureToGainMap(TrainedEnsemble.Trees.ToList(), normalize: true); var names = default(VBuffer>); AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, NumFeatures, ref names); var ordered = gainMap.OrderByDescending(pair => pair.Value); - Double max = ordered.FirstOrDefault().Value; - Double normFactor = max == 0 ? 1.0 : (1.0 / Math.Sqrt(max)); + double max = ordered.FirstOrDefault().Value; + double normFactor = max == 0 ? 1.0 : (1.0 / Math.Sqrt(max)); foreach (var pair in ordered) { var name = names.GetItemOrDefault(pair.Key).ToString(); if (string.IsNullOrEmpty(name)) name = $"f{pair.Key}"; - yield return new KeyValuePair(name, Math.Sqrt(pair.Value) * normFactor); + yield return new KeyValuePair(name, Math.Sqrt(pair.Value) * normFactor); } } @@ -3230,6 +3231,9 @@ private void ToCSharp(InternalRegressionTree tree, TextWriter writer, int node, } } + /// + /// Copy the weights of all training features to . + /// public void GetFeatureWeights(ref VBuffer weights) { var numFeatures = Math.Max(NumFeatures, MaxSplitFeatIdx + 1); @@ -3242,8 +3246,8 @@ public void GetFeatureWeights(ref VBuffer weights) return; } - Double max = gainMap.Values.Max(); - Double normFactor = max == 0 ? 1.0 : (1.0 / Math.Sqrt(max)); + double max = gainMap.Values.Max(); + double normFactor = max == 0 ? 1.0 : (1.0 / Math.Sqrt(max)); var bldr = new BufferBuilder(R4Adder.Instance); bldr.Reset(numFeatures, false); foreach (var pair in gainMap) @@ -3256,7 +3260,8 @@ ITree[] ITreeEnsemble.GetTrees() return TrainedEnsemble.Trees.Select(k => new Tree(k)).ToArray(); } - public float GetLeafValue(int treeId, int leafId) + [BestFriend] + internal float GetLeafValue(int treeId, int leafId) { return (float)TrainedEnsemble.GetTreeAt(treeId).LeafValue(leafId); } @@ -3266,7 +3271,8 @@ public float GetLeafValue(int treeId, int leafId) /// internal nodes in the path from the root to that leaf. If 'path' is null a new list is initialized. All elements /// in 'path' are cleared before filling in the current path nodes. /// - public int GetLeaf(int treeId, in VBuffer features, ref List path) + [BestFriend] + internal int GetLeaf(int treeId, in VBuffer features, ref List path) { return TrainedEnsemble.GetTreeAt(treeId).GetLeaf(in features, ref path); } @@ -3286,10 +3292,7 @@ DataViewRow ICanGetSummaryAsIRow.GetSummaryIRowOrNull(RoleMappedSchema schema) return AnnotationUtils.AnnotationsAsRow(builder.ToAnnotations()); } - DataViewRow ICanGetSummaryAsIRow.GetStatsIRowOrNull(RoleMappedSchema schema) - { - return null; - } + DataViewRow ICanGetSummaryAsIRow.GetStatsIRowOrNull(RoleMappedSchema schema) => null; private sealed class Tree : ITree> { @@ -3431,6 +3434,7 @@ private protected TreeEnsembleModelParametersBasedOnQuantileRegressionTree(IHost TrainedTreeEnsemble = CreateTreeEnsembleFromInternalDataStructure(); } + [BestFriend] private protected TreeEnsembleModelParametersBasedOnQuantileRegressionTree(IHostEnvironment env, string name, ModelLoadContext ctx, VersionInfo ver) : base(env, name, ctx, ver) { diff --git a/src/Microsoft.ML.FastTree/FastTreeArguments.cs b/src/Microsoft.ML.FastTree/FastTreeArguments.cs index be8ca0f0cc..74a72dc8da 100644 --- a/src/Microsoft.ML.FastTree/FastTreeArguments.cs +++ b/src/Microsoft.ML.FastTree/FastTreeArguments.cs @@ -134,7 +134,7 @@ internal override void Check(IExceptionContext ectx) } } - public enum Bundle : Byte + public enum Bundle : byte { None = 0, AggregateLowPopulation = 1, @@ -144,10 +144,10 @@ public enum Bundle : Byte [BestFriend] internal static class Defaults { - public const int NumTrees = 100; - public const int NumLeaves = 20; - public const int MinDocumentsInLeaves = 10; - public const double LearningRates = 0.2; + public const int NumberOfTrees = 100; + public const int NumberOfLeaves = 20; + public const int MinExampleCountInLeaves = 10; + public const double LearningRate = 0.2; } public abstract class TreeOptions : TrainerInputBaseWithGroupId @@ -161,8 +161,8 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// /// The number of threads to use. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The number of threads to use", ShortName = "t", NullName = "")] - public int? NumThreads = null; + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The number of threads to use", ShortName = "t,NumThreads", NullName = "")] + public int? NumberOfThreads = null; // this random seed is used for: // 1. doc sampling for feature binning @@ -174,16 +174,16 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// /// The seed of the random number generator. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The seed of the random number generator", ShortName = "r1")] - public int RngSeed = 123; + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The seed of the random number generator", ShortName = "r1,RngSeed")] + public int RandomSeed = 123; // this random seed is only for active feature selection /// /// The seed of the active feature selection. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The seed of the active feature selection", ShortName = "r3", Hide = true)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The seed of the active feature selection", ShortName = "r3,FeatureSelectSeed", Hide = true)] [TGUI(NotGui = true)] - public int FeatureSelectSeed = 123; + public int FeatureSelectionRandomSeed = 123; /// /// The entropy (regularization) coefficient between 0 and 1. @@ -231,16 +231,16 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId public int MaxCategoricalSplitPoints = 64; /// - /// Minimum categorical docs percentage in a bin to consider for a split. + /// Minimum categorical example percentage in a bin to consider for a split. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum categorical docs percentage in a bin to consider for a split.", ShortName = "mdop")] - public double MinDocsPercentageForCategoricalSplit = 0.001; + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum categorical docs percentage in a bin to consider for a split.", ShortName = "mdop,MinDocsPercentageForCategoricalSplit")] + public double MinExamplePercentageForCategoricalSplit = 0.001; /// - /// Minimum categorical doc count in a bin to consider for a split. + /// Minimum categorical example count in a bin to consider for a split. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum categorical doc count in a bin to consider for a split.", ShortName = "mdo")] - public int MinDocsForCategoricalSplit = 100; + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum categorical doc count in a bin to consider for a split.", ShortName = "mdo,MinDocsForCategoricalSplit")] + public int MinExamplesForCategoricalSplit = 100; /// /// Bias for calculating gradient for each feature bin for a categorical feature. @@ -262,8 +262,8 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// /// Maximum number of distinct values (bins) per feature. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum number of distinct values (bins) per feature", ShortName = "mb")] - public int MaxBins = 255; // save one for undefs + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum number of distinct values (bins) per feature", ShortName = "mb,MaxBins")] + public int MaxBinCountPerFeature = 255; // save one for undefs /// /// Sparsity level needed to use sparse feature representation. @@ -307,29 +307,29 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// /// The max number of leaves in each regression tree. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The max number of leaves in each regression tree", ShortName = "nl", SortOrder = 2)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The max number of leaves in each regression tree", ShortName = "nl,NumLeaves", SortOrder = 2)] [TGUI(Description = "The maximum number of leaves per tree", SuggestedSweeps = "2-128;log;inc:4")] [TlcModule.SweepableLongParamAttribute("NumLeaves", 2, 128, isLogScale: true, stepSize: 4)] - public int NumLeaves = Defaults.NumLeaves; + public int NumberOfLeaves = Defaults.NumberOfLeaves; /// /// The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data. /// // REVIEW: Arrays not supported in GUI // REVIEW: Different shortname than FastRank module. Same as the TLC FRWrapper. - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", ShortName = "mil", SortOrder = 3)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", ShortName = "mil,MinDocumentsInLeafs", SortOrder = 3)] [TGUI(Description = "Minimum number of training instances required to form a leaf", SuggestedSweeps = "1,10,50")] [TlcModule.SweepableDiscreteParamAttribute("MinDocumentsInLeafs", new object[] { 1, 10, 50 })] - public int MinDocumentsInLeafs = Defaults.MinDocumentsInLeaves; + public int MinExampleCountPerLeaf = Defaults.MinExampleCountInLeaves; /// /// Total number of decision trees to create in the ensemble. /// // REVIEW: Different shortname than FastRank module. Same as the TLC FRWrapper. - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Total number of decision trees to create in the ensemble", ShortName = "iter", SortOrder = 1)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Total number of decision trees to create in the ensemble", ShortName = "iter,NumTrees", SortOrder = 1)] [TGUI(Description = "Total number of trees constructed", SuggestedSweeps = "20,100,500")] [TlcModule.SweepableDiscreteParamAttribute("NumTrees", new object[] { 20, 100, 500 })] - public int NumTrees = Defaults.NumTrees; + public int NumberOfTrees = Defaults.NumberOfTrees; /// /// The fraction of features (chosen randomly) to use on each iteration. @@ -346,18 +346,18 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// /// Percentage of training examples used in each bag. /// - [Argument(ArgumentType.AtMostOnce, HelpText = "Percentage of training examples used in each bag", ShortName = "bagfrac")] + [Argument(ArgumentType.AtMostOnce, HelpText = "Percentage of training examples used in each bag", ShortName = "bagfrac,BaggingTrainFraction")] // REVIEW: sweeping bagfrac doesn't make sense unless 'baggingSize' is non-zero. The 'SuggestedSweeps' here // are used to denote 'sensible range', but the GUI will interpret this as 'you must sweep these values'. So, I'm keeping // the values there for the future, when we have an appropriate way to encode this information. // [TGUI(SuggestedSweeps = "0.5,0.7,0.9")] - public Double BaggingTrainFraction = 0.7; + public Double BaggingExampleFraction = 0.7; /// /// The fraction of features (chosen randomly) to use on each split. /// - [Argument(ArgumentType.AtMostOnce, HelpText = "The fraction of features (chosen randomly) to use on each split", ShortName = "sf")] - public Double SplitFraction = 1; + [Argument(ArgumentType.AtMostOnce, HelpText = "The fraction of features (chosen randomly) to use on each split", ShortName = "sf,SplitFraction")] + public Double FeatureFractionPerSplit = 1; /// /// Smoothing paramter for tree regularization. @@ -390,9 +390,9 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// Maximum Number of trees after compression. /// // REVIEW: Not used. - [Argument(ArgumentType.AtMostOnce, HelpText = "Maximum Number of trees after compression", ShortName = "cmpmax", Hide = true)] + [Argument(ArgumentType.AtMostOnce, HelpText = "Maximum Number of trees after compression", ShortName = "cmpmax,MaxTreesAfterCompression", Hide = true)] [TGUI(NotGui = true)] - public int MaxTreesAfterCompression = -1; + public int MaxTreeCountAfterCompression = -1; /// /// Print metrics graph for the first test set. @@ -418,27 +418,27 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId internal virtual void Check(IExceptionContext ectx) { Contracts.AssertValue(ectx); - ectx.CheckUserArg(NumThreads == null || NumThreads > 0, nameof(NumThreads), "numThreads must be positive."); - ectx.CheckUserArg(NumLeaves >= 2, nameof(NumLeaves), "numLeaves must be at least 2."); - ectx.CheckUserArg(0 <= EntropyCoefficient && EntropyCoefficient <= 1, nameof(EntropyCoefficient), "entropyCoefficient must be between 0 and 1."); - ectx.CheckUserArg(0 <= GainConfidenceLevel && GainConfidenceLevel < 1, nameof(GainConfidenceLevel), "gainConfidenceLevel must be in [0, 1)."); - ectx.CheckUserArg(0 <= FeatureFraction && FeatureFraction <= 1, nameof(FeatureFraction), "featureFraction must be between 0 and 1."); - ectx.CheckUserArg(0 <= SplitFraction && SplitFraction <= 1, nameof(SplitFraction), "splitFraction must be between 0 and 1."); - ectx.CheckUserArg(0 <= SoftmaxTemperature, nameof(SoftmaxTemperature), "softmaxTemperature must be non-negative."); - ectx.CheckUserArg(0 < MaxBins, nameof(MaxBins), "maxBins must greater than 0."); - ectx.CheckUserArg(0 <= SparsifyThreshold && SparsifyThreshold <= 1, nameof(SparsifyThreshold), "specifyThreshold must be between 0 and 1."); - ectx.CheckUserArg(0 < NumTrees, nameof(NumTrees), "Number of trees must be positive."); - ectx.CheckUserArg(0 <= Smoothing && Smoothing <= 1, nameof(Smoothing), "smoothing must be between 0 and 1."); - ectx.CheckUserArg(0 <= BaggingSize, nameof(BaggingSize), "baggingSize must be non-negative."); - ectx.CheckUserArg(0 <= BaggingTrainFraction && BaggingTrainFraction <= 1, nameof(BaggingTrainFraction), "baggingTrainFraction must be between 0 and 1."); - ectx.CheckUserArg(0 <= FeatureFirstUsePenalty, nameof(FeatureFirstUsePenalty), "featureFirstUsePenalty must be non-negative."); - ectx.CheckUserArg(0 <= FeatureReusePenalty, nameof(FeatureReusePenalty), "featureReusePenalty must be non-negative."); - ectx.CheckUserArg(0 <= MaxCategoricalGroupsPerNode, nameof(MaxCategoricalGroupsPerNode), "maxCategoricalGroupsPerNode must be non-negative."); - ectx.CheckUserArg(0 <= MaxCategoricalSplitPoints, nameof(MaxCategoricalSplitPoints), "maxCategoricalSplitPoints must be non-negative."); - ectx.CheckUserArg(0 <= MinDocsPercentageForCategoricalSplit, nameof(MinDocsPercentageForCategoricalSplit), "minDocsPercentageForCategoricalSplit must be non-negative."); - ectx.CheckUserArg(0 <= MinDocsForCategoricalSplit, nameof(MinDocsForCategoricalSplit), "minDocsForCategoricalSplit must be non-negative."); - ectx.CheckUserArg(Bundle.None <= Bundling && Bundling <= Bundle.Adjacent, nameof(Bundling), "bundling must be between 0 and 2."); - ectx.CheckUserArg(Bias >= 0, nameof(Bias), "Bias must be greater than equal to zero."); + ectx.CheckUserArg(NumberOfThreads == null || NumberOfThreads > 0, nameof(NumberOfThreads), "Must be positive."); + ectx.CheckUserArg(NumberOfLeaves >= 2, nameof(NumberOfLeaves), "Must be at least 2."); + ectx.CheckUserArg(0 <= EntropyCoefficient && EntropyCoefficient <= 1, nameof(EntropyCoefficient), "Must be between 0 and 1."); + ectx.CheckUserArg(0 <= GainConfidenceLevel && GainConfidenceLevel < 1, nameof(GainConfidenceLevel), "Must be in [0, 1)."); + ectx.CheckUserArg(0 <= FeatureFraction && FeatureFraction <= 1, nameof(FeatureFraction), "Must be between 0 and 1."); + ectx.CheckUserArg(0 <= FeatureFractionPerSplit && FeatureFractionPerSplit <= 1, nameof(FeatureFractionPerSplit), "Must be between 0 and 1."); + ectx.CheckUserArg(0 <= SoftmaxTemperature, nameof(SoftmaxTemperature), "Must be non-negative."); + ectx.CheckUserArg(0 < MaxBinCountPerFeature, nameof(MaxBinCountPerFeature), "Must greater than 0."); + ectx.CheckUserArg(0 <= SparsifyThreshold && SparsifyThreshold <= 1, nameof(SparsifyThreshold), "Must be between 0 and 1."); + ectx.CheckUserArg(0 < NumberOfTrees, nameof(NumberOfTrees), "Must be positive."); + ectx.CheckUserArg(0 <= Smoothing && Smoothing <= 1, nameof(Smoothing), "Must be between 0 and 1."); + ectx.CheckUserArg(0 <= BaggingSize, nameof(BaggingSize), "Must be non-negative."); + ectx.CheckUserArg(0 <= BaggingExampleFraction && BaggingExampleFraction <= 1, nameof(BaggingExampleFraction), "Must be between 0 and 1."); + ectx.CheckUserArg(0 <= FeatureFirstUsePenalty, nameof(FeatureFirstUsePenalty), "Must be non-negative."); + ectx.CheckUserArg(0 <= FeatureReusePenalty, nameof(FeatureReusePenalty), "Must be non-negative."); + ectx.CheckUserArg(0 <= MaxCategoricalGroupsPerNode, nameof(MaxCategoricalGroupsPerNode), "Must be non-negative."); + ectx.CheckUserArg(0 <= MaxCategoricalSplitPoints, nameof(MaxCategoricalSplitPoints), "Must be non-negative."); + ectx.CheckUserArg(0 <= MinExamplePercentageForCategoricalSplit, nameof(MinExamplePercentageForCategoricalSplit), "Must be non-negative."); + ectx.CheckUserArg(0 <= MinExamplesForCategoricalSplit, nameof(MinExamplesForCategoricalSplit), "Must be non-negative."); + ectx.CheckUserArg(Bundle.None <= Bundling && Bundling <= Bundle.Adjacent, nameof(Bundling), "Must be between 0 and 2."); + ectx.CheckUserArg(Bias >= 0, nameof(Bias), "Must be greater than equal to zero."); } } @@ -462,8 +462,8 @@ public abstract class BoostedTreeOptions : TreeOptions /// /// Number of post-bracket line search steps. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Number of post-bracket line search steps", ShortName = "lssteps")] - public int NumPostBracketSteps; + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Number of post-bracket line search steps", ShortName = "lssteps,NumPostBracketSteps")] + public int MaxNumberOfLinearSearchSteps; /// /// Minimum line search step size. @@ -522,10 +522,10 @@ public enum OptimizationAlgorithmType { GradientDescent, AcceleratedGradientDesc /// /// The learning rate. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The learning rate", ShortName = "lr", SortOrder = 4)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The learning rate", ShortName = "lr,LearningRates", SortOrder = 4)] [TGUI(Label = "Learning Rate", SuggestedSweeps = "0.025-0.4;log")] [TlcModule.SweepableFloatParamAttribute("LearningRates", 0.025f, 0.4f, isLogScale: true)] - public Double LearningRates = Defaults.LearningRates; + public Double LearningRate = Defaults.LearningRate; /// /// Shrinkage. @@ -630,14 +630,14 @@ internal override void Check(IExceptionContext ectx) { base.Check(ectx); - ectx.CheckUserArg(0 <= MaxTreeOutput, nameof(MaxTreeOutput), "maxTreeOutput must be non-negative."); - ectx.CheckUserArg(0 <= PruningThreshold, nameof(PruningThreshold), "pruningThreshold must be non-negative."); - ectx.CheckUserArg(0 < PruningWindowSize, nameof(PruningWindowSize), "pruningWindowSize must be positive."); - ectx.CheckUserArg(0 < Shrinkage, nameof(Shrinkage), "shrinkage must be positive."); - ectx.CheckUserArg(0 <= DropoutRate && DropoutRate <= 1, nameof(DropoutRate), "dropoutRate must be between 0 and 1."); - ectx.CheckUserArg(0 < GetDerivativesSampleRate, nameof(GetDerivativesSampleRate), "getDerivativesSampleRate must be positive."); - ectx.CheckUserArg(0 <= NumPostBracketSteps, nameof(NumPostBracketSteps), "numPostBracketSteps must be non-negative."); - ectx.CheckUserArg(0 <= MinStepSize, nameof(MinStepSize), "minStepSize must be non-negative."); + ectx.CheckUserArg(0 <= MaxTreeOutput, nameof(MaxTreeOutput), "Must be non-negative."); + ectx.CheckUserArg(0 <= PruningThreshold, nameof(PruningThreshold), "Must be non-negative."); + ectx.CheckUserArg(0 < PruningWindowSize, nameof(PruningWindowSize), "Must be positive."); + ectx.CheckUserArg(0 < Shrinkage, nameof(Shrinkage), "Must be positive."); + ectx.CheckUserArg(0 <= DropoutRate && DropoutRate <= 1, nameof(DropoutRate), "Must be between 0 and 1."); + ectx.CheckUserArg(0 < GetDerivativesSampleRate, nameof(GetDerivativesSampleRate), "Must be positive."); + ectx.CheckUserArg(0 <= MaxNumberOfLinearSearchSteps, nameof(MaxNumberOfLinearSearchSteps), "Must be non-negative."); + ectx.CheckUserArg(0 <= MinStepSize, nameof(MinStepSize), "Must be non-negative."); } } } diff --git a/src/Microsoft.ML.FastTree/FastTreeClassification.cs b/src/Microsoft.ML.FastTree/FastTreeClassification.cs index 51b406f50e..a3e2de32ca 100644 --- a/src/Microsoft.ML.FastTree/FastTreeClassification.cs +++ b/src/Microsoft.ML.FastTree/FastTreeClassification.cs @@ -130,14 +130,14 @@ internal FastTreeBinaryClassificationTrainer(IHostEnvironment env, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, string weightColumn = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves, - double learningRate = Defaults.LearningRates) + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + double learningRate = Defaults.LearningRate) : base(env, TrainerUtils.MakeBoolScalarLabel(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves, learningRate) { // Set the sigmoid parameter to the 2 * learning rate, for traditional FastTreeClassification loss - _sigmoidParameter = 2.0 * FastTreeTrainerOptions.LearningRates; + _sigmoidParameter = 2.0 * FastTreeTrainerOptions.LearningRate; } /// @@ -149,7 +149,7 @@ internal FastTreeBinaryClassificationTrainer(IHostEnvironment env, Options optio : base(env, options, TrainerUtils.MakeBoolScalarLabel(options.LabelColumnName)) { // Set the sigmoid parameter to the 2 * learning rate, for traditional FastTreeClassification loss - _sigmoidParameter = 2.0 * FastTreeTrainerOptions.LearningRates; + _sigmoidParameter = 2.0 * FastTreeTrainerOptions.LearningRate; } private protected override PredictionKind PredictionKind => PredictionKind.BinaryClassification; @@ -191,14 +191,14 @@ private protected override ObjectiveFunctionBase ConstructObjFunc(IChannel ch) return new ObjectiveImpl( TrainSet, _trainSetLabels, - FastTreeTrainerOptions.LearningRates, + FastTreeTrainerOptions.LearningRate, FastTreeTrainerOptions.Shrinkage, _sigmoidParameter, FastTreeTrainerOptions.UnbalancedSets, FastTreeTrainerOptions.MaxTreeOutput, FastTreeTrainerOptions.GetDerivativesSampleRate, FastTreeTrainerOptions.BestStepRankingRegressionTrees, - FastTreeTrainerOptions.RngSeed, + FastTreeTrainerOptions.RandomSeed, ParallelTraining); } @@ -209,7 +209,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm( { var lossCalculator = new BinaryClassificationTest(optimizationAlgorithm.TrainingScores, _trainSetLabels, _sigmoidParameter); // REVIEW: we should makeloss indices an enum in BinaryClassificationTest - optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(lossCalculator, FastTreeTrainerOptions.UnbalancedSets ? 3 /*Unbalanced sets loss*/ : 1 /*normal loss*/, FastTreeTrainerOptions.NumPostBracketSteps, FastTreeTrainerOptions.MinStepSize); + optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(lossCalculator, FastTreeTrainerOptions.UnbalancedSets ? 3 /*Unbalanced sets loss*/ : 1 /*normal loss*/, FastTreeTrainerOptions.MaxNumberOfLinearSearchSteps, FastTreeTrainerOptions.MinStepSize); } return optimizationAlgorithm; } diff --git a/src/Microsoft.ML.FastTree/FastTreeRanking.cs b/src/Microsoft.ML.FastTree/FastTreeRanking.cs index 88e5c41485..fef3f31eaa 100644 --- a/src/Microsoft.ML.FastTree/FastTreeRanking.cs +++ b/src/Microsoft.ML.FastTree/FastTreeRanking.cs @@ -74,10 +74,10 @@ internal FastTreeRankingTrainer(IHostEnvironment env, string featureColumn = DefaultColumnNames.Features, string groupIdColumn = DefaultColumnNames.GroupId, string weightColumn = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves, - double learningRate = Defaults.LearningRates) + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + double learningRate = Defaults.LearningRate) : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, groupIdColumn, numLeaves, numTrees, minDatapointsInLeaves, learningRate) { Host.CheckNonEmpty(groupIdColumn, nameof(groupIdColumn)); @@ -178,7 +178,7 @@ private protected override void Initialize(IChannel ch) if (FastTreeTrainerOptions.CompressEnsemble) { _ensembleCompressor = new LassoBasedEnsembleCompressor(); - _ensembleCompressor.Initialize(FastTreeTrainerOptions.NumTrees, TrainSet, TrainSet.Ratings, FastTreeTrainerOptions.RngSeed); + _ensembleCompressor.Initialize(FastTreeTrainerOptions.NumberOfTrees, TrainSet, TrainSet.Ratings, FastTreeTrainerOptions.RandomSeed); } } @@ -193,7 +193,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm( if (FastTreeTrainerOptions.UseLineSearch) { _specialTrainSetTest = new FastNdcgTest(optimizationAlgorithm.TrainingScores, TrainSet.Ratings, FastTreeTrainerOptions.SortingAlgorithm, FastTreeTrainerOptions.EarlyStoppingMetrics); - optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(_specialTrainSetTest, 0, FastTreeTrainerOptions.NumPostBracketSteps, FastTreeTrainerOptions.MinStepSize); + optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(_specialTrainSetTest, 0, FastTreeTrainerOptions.MaxNumberOfLinearSearchSteps, FastTreeTrainerOptions.MinStepSize); } return optimizationAlgorithm; } @@ -201,7 +201,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm( private protected override BaggingProvider CreateBaggingProvider() { Host.Assert(FastTreeTrainerOptions.BaggingSize > 0); - return new RankingBaggingProvider(TrainSet, FastTreeTrainerOptions.NumLeaves, FastTreeTrainerOptions.RngSeed, FastTreeTrainerOptions.BaggingTrainFraction); + return new RankingBaggingProvider(TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.RandomSeed, FastTreeTrainerOptions.BaggingExampleFraction); } private protected override void PrepareLabels(IChannel ch) @@ -552,12 +552,12 @@ private enum DupeIdInfo public LambdaRankObjectiveFunction(Dataset trainset, short[] labels, Options options, IParallelTraining parallelTraining) : base(trainset, - options.LearningRates, + options.LearningRate, options.Shrinkage, options.MaxTreeOutput, options.GetDerivativesSampleRate, options.BestStepRankingRegressionTrees, - options.RngSeed) + options.RandomSeed) { _labels = labels; @@ -607,7 +607,7 @@ public LambdaRankObjectiveFunction(Dataset trainset, short[] labels, Options opt FillGainLabels(); #region parameters - _sigmoidParam = options.LearningRates; + _sigmoidParam = options.LearningRate; _costFunctionParam = options.CostFunctionParam; _distanceWeight2 = options.DistanceWeight2; _normalizeQueryLambdas = options.NormalizeQueryLambdas; @@ -676,7 +676,7 @@ private void SetupBaselineRisk(Options options) uint[] vals = new uint[ffmap.RawFeatureCount]; int iInd = Array.IndexOf(ffnames, "I"); int tInd = Array.IndexOf(ffnames, "T"); - int totalTrees = options.NumTrees; + int totalTrees = options.NumberOfTrees; if (tInd >= 0) vals[tInd] = (uint)totalTrees; _baselineAlpha = Enumerable.Range(0, totalTrees).Select(i => diff --git a/src/Microsoft.ML.FastTree/FastTreeRegression.cs b/src/Microsoft.ML.FastTree/FastTreeRegression.cs index 3533adfd6a..0cbf9124ed 100644 --- a/src/Microsoft.ML.FastTree/FastTreeRegression.cs +++ b/src/Microsoft.ML.FastTree/FastTreeRegression.cs @@ -63,10 +63,10 @@ internal FastTreeRegressionTrainer(IHostEnvironment env, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, string weightColumn = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves, - double learningRate = Defaults.LearningRates) + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + double learningRate = Defaults.LearningRate) : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves, learningRate) { } @@ -127,7 +127,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm( { var lossCalculator = new RegressionTest(optimizationAlgorithm.TrainingScores); // REVIEW: We should make loss indices an enum in BinaryClassificationTest. - optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(lossCalculator, 1 /*L2 error*/, FastTreeTrainerOptions.NumPostBracketSteps, FastTreeTrainerOptions.MinStepSize); + optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(lossCalculator, 1 /*L2 error*/, FastTreeTrainerOptions.MaxNumberOfLinearSearchSteps, FastTreeTrainerOptions.MinStepSize); } return optimizationAlgorithm; @@ -403,12 +403,12 @@ public ObjectiveImpl(Dataset trainData, RegressionGamTrainer.Options options) : public ObjectiveImpl(Dataset trainData, Options options) : base( trainData, - options.LearningRates, + options.LearningRate, options.Shrinkage, options.MaxTreeOutput, options.GetDerivativesSampleRate, options.BestStepRankingRegressionTrees, - options.RngSeed) + options.RandomSeed) { if (options.DropoutRate > 0 && LearningRate > 0) // Don't do shrinkage if dropouts are used. Shrinkage = 1.0 / LearningRate; diff --git a/src/Microsoft.ML.FastTree/FastTreeTweedie.cs b/src/Microsoft.ML.FastTree/FastTreeTweedie.cs index b18ed335f3..9fdc0301e3 100644 --- a/src/Microsoft.ML.FastTree/FastTreeTweedie.cs +++ b/src/Microsoft.ML.FastTree/FastTreeTweedie.cs @@ -61,10 +61,10 @@ internal FastTreeTweedieTrainer(IHostEnvironment env, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, string weightColumn = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves, - double learningRate = Defaults.LearningRates) + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + double learningRate = Defaults.LearningRate) : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves, learningRate) { Host.CheckNonEmpty(labelColumn, nameof(labelColumn)); @@ -134,7 +134,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm( var lossCalculator = new RegressionTest(optimizationAlgorithm.TrainingScores); // REVIEW: We should make loss indices an enum in BinaryClassificationTest. // REVIEW: Nope, subcomponent. - optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(lossCalculator, 1 /*L2 error*/, FastTreeTrainerOptions.NumPostBracketSteps, FastTreeTrainerOptions.MinStepSize); + optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(lossCalculator, 1 /*L2 error*/, FastTreeTrainerOptions.MaxNumberOfLinearSearchSteps, FastTreeTrainerOptions.MinStepSize); } return optimizationAlgorithm; @@ -341,12 +341,12 @@ private sealed class ObjectiveImpl : ObjectiveFunctionBase, IStepSearch public ObjectiveImpl(Dataset trainData, Options options) : base( trainData, - options.LearningRates, + options.LearningRate, options.Shrinkage, options.MaxTreeOutput, options.GetDerivativesSampleRate, options.BestStepRankingRegressionTrees, - options.RngSeed) + options.RandomSeed) { if (options.DropoutRate > 0 && LearningRate > 0) // Don't do shrinkage if dropouts are used. Shrinkage = 1.0 / LearningRate; diff --git a/src/Microsoft.ML.FastTree/RandomForest.cs b/src/Microsoft.ML.FastTree/RandomForest.cs index 73ac1e36d5..684039fb7b 100644 --- a/src/Microsoft.ML.FastTree/RandomForest.cs +++ b/src/Microsoft.ML.FastTree/RandomForest.cs @@ -61,12 +61,12 @@ private protected override void InitializeTests() private protected override TreeLearner ConstructTreeLearner(IChannel ch) { return new RandomForestLeastSquaresTreeLearner( - TrainSet, FastTreeTrainerOptions.NumLeaves, FastTreeTrainerOptions.MinDocumentsInLeafs, FastTreeTrainerOptions.EntropyCoefficient, + TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.MinExampleCountPerLeaf, FastTreeTrainerOptions.EntropyCoefficient, FastTreeTrainerOptions.FeatureFirstUsePenalty, FastTreeTrainerOptions.FeatureReusePenalty, FastTreeTrainerOptions.SoftmaxTemperature, - FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.RngSeed, FastTreeTrainerOptions.SplitFraction, + FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.RandomSeed, FastTreeTrainerOptions.FeatureFractionPerSplit, FastTreeTrainerOptions.AllowEmptyTrees, FastTreeTrainerOptions.GainConfidenceLevel, FastTreeTrainerOptions.MaxCategoricalGroupsPerNode, FastTreeTrainerOptions.MaxCategoricalSplitPoints, _quantileEnabled, FastTreeTrainerOptions.QuantileSampleCount, ParallelTraining, - FastTreeTrainerOptions.MinDocsPercentageForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinDocsForCategoricalSplit, FastTreeTrainerOptions.Bias); + FastTreeTrainerOptions.MinExamplePercentageForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinExamplesForCategoricalSplit, FastTreeTrainerOptions.Bias); } internal abstract class RandomForestObjectiveFunction : ObjectiveFunctionBase @@ -78,7 +78,7 @@ protected RandomForestObjectiveFunction(Dataset trainData, TOptions options, dou maxStepSize, 1, // No derivative sampling in random forests. false, // Improvements to quasi-newton step not relevant to RF. - options.RngSeed) + options.RandomSeed) { } } diff --git a/src/Microsoft.ML.FastTree/RandomForestClassification.cs b/src/Microsoft.ML.FastTree/RandomForestClassification.cs index 60fc2e6242..0ad6268f80 100644 --- a/src/Microsoft.ML.FastTree/RandomForestClassification.cs +++ b/src/Microsoft.ML.FastTree/RandomForestClassification.cs @@ -39,7 +39,7 @@ public FastForestOptionsBase() { FeatureFraction = 0.7; BaggingSize = 1; - SplitFraction = 0.7; + FeatureFractionPerSplit = 0.7; } } @@ -145,9 +145,9 @@ internal FastForestClassification(IHostEnvironment env, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, string weightColumn = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves) + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves) : base(env, TrainerUtils.MakeBoolScalarLabel(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves) { Host.CheckNonEmpty(labelColumn, nameof(labelColumn)); diff --git a/src/Microsoft.ML.FastTree/RandomForestRegression.cs b/src/Microsoft.ML.FastTree/RandomForestRegression.cs index 359217da05..609dbad46f 100644 --- a/src/Microsoft.ML.FastTree/RandomForestRegression.cs +++ b/src/Microsoft.ML.FastTree/RandomForestRegression.cs @@ -274,9 +274,9 @@ internal FastForestRegression(IHostEnvironment env, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, string weightColumn = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves) + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves) : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves) { Host.CheckNonEmpty(labelColumn, nameof(labelColumn)); diff --git a/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs b/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs index 7d33a01796..b9ae9dd0c6 100644 --- a/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs +++ b/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs @@ -28,10 +28,10 @@ public static FastTreeRegressionTrainer FastTree(this RegressionCatalog.Regressi string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves, - double learningRate = Defaults.LearningRates) + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + double learningRate = Defaults.LearningRate) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); @@ -68,10 +68,10 @@ public static FastTreeBinaryClassificationTrainer FastTree(this BinaryClassifica string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves, - double learningRate = Defaults.LearningRates) + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + double learningRate = Defaults.LearningRate) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); @@ -110,10 +110,10 @@ public static FastTreeRankingTrainer FastTree(this RankingCatalog.RankingTrainer string featureColumnName = DefaultColumnNames.Features, string rowGroupColumnName = DefaultColumnNames.GroupId, string exampleWeightColumnName = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves, - double learningRate = Defaults.LearningRates) + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + double learningRate = Defaults.LearningRate) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); @@ -222,10 +222,10 @@ public static FastTreeTweedieTrainer FastTreeTweedie(this RegressionCatalog.Regr string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves, - double learningRate = Defaults.LearningRates) + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + double learningRate = Defaults.LearningRate) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); @@ -261,9 +261,9 @@ public static FastForestRegression FastForest(this RegressionCatalog.RegressionT string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves) + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); @@ -299,9 +299,9 @@ public static FastForestClassification FastForest(this BinaryClassificationCatal string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves) + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); diff --git a/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs b/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs index 49e12c4098..24f643a259 100644 --- a/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs +++ b/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs @@ -39,10 +39,10 @@ public static class TreeRegressionExtensions /// public static Scalar FastTree(this RegressionCatalog.RegressionTrainers catalog, Scalar label, Vector features, Scalar weights = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves, - double learningRate = Defaults.LearningRates, + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + double learningRate = Defaults.LearningRate, Action onFit = null) { CheckUserValues(label, features, weights, numLeaves, numTrees, minDatapointsInLeaves, learningRate, onFit); @@ -132,10 +132,10 @@ public static Scalar FastTree(this RegressionCatalog.RegressionTrainers c /// public static (Scalar score, Scalar probability, Scalar predictedLabel) FastTree(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, Scalar label, Vector features, Scalar weights = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves, - double learningRate = Defaults.LearningRates, + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + double learningRate = Defaults.LearningRate, Action> onFit = null) { CheckUserValues(label, features, weights, numLeaves, numTrees, minDatapointsInLeaves, learningRate, onFit); @@ -224,10 +224,10 @@ public static (Scalar score, Scalar probability, Scalar pred /// The Score output column indicating the predicted value. public static Scalar FastTree(this RankingCatalog.RankingTrainers catalog, Scalar label, Vector features, Key groupId, Scalar weights = null, - int numLeaves = Defaults.NumLeaves, - int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves, - double learningRate = Defaults.LearningRates, + int numLeaves = Defaults.NumberOfLeaves, + int numTrees = Defaults.NumberOfTrees, + int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + double learningRate = Defaults.LearningRate, Action onFit = null) { CheckUserValues(label, features, weights, numLeaves, numTrees, minDatapointsInLeaves, learningRate, onFit); diff --git a/src/Microsoft.ML.Sweeper/Algorithms/SmacSweeper.cs b/src/Microsoft.ML.Sweeper/Algorithms/SmacSweeper.cs index 123eafddac..3401c49843 100644 --- a/src/Microsoft.ML.Sweeper/Algorithms/SmacSweeper.cs +++ b/src/Microsoft.ML.Sweeper/Algorithms/SmacSweeper.cs @@ -137,8 +137,8 @@ private FastForestRegressionModelParameters FitModel(IEnumerable pre new FastForestRegression.Options { FeatureFraction = _args.SplitRatio, - NumTrees = _args.NumOfTrees, - MinDocumentsInLeafs = _args.NMinForSplit, + NumberOfTrees = _args.NumOfTrees, + MinExampleCountPerLeaf = _args.NMinForSplit, LabelColumnName = DefaultColumnNames.Label, FeatureColumnName = DefaultColumnNames.Features, }); diff --git a/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs b/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs index 54dadb5b51..d92db665ca 100644 --- a/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs +++ b/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs @@ -3528,8 +3528,8 @@ public void EntryPointTreeLeafFeaturizer() var fastTree = Trainers.FastTree.FastTree.TrainBinary(Env, new FastTreeBinaryClassificationTrainer.Options { FeatureColumnName = "Features", - NumTrees = 5, - NumLeaves = 4, + NumberOfTrees = 5, + NumberOfLeaves = 4, LabelColumnName = DefaultColumnNames.Label, TrainingData = concat.OutputData }); diff --git a/test/Microsoft.ML.Functional.Tests/Evaluation.cs b/test/Microsoft.ML.Functional.Tests/Evaluation.cs index 7abd1f3241..49d510593f 100644 --- a/test/Microsoft.ML.Functional.Tests/Evaluation.cs +++ b/test/Microsoft.ML.Functional.Tests/Evaluation.cs @@ -179,7 +179,7 @@ public void TrainAndEvaluateRanking() // Create a training pipeline. var pipeline = mlContext.Transforms.Concatenate("Features", Iris.Features) - .Append(mlContext.Ranking.Trainers.FastTree(new FastTreeRankingTrainer.Options { NumThreads = 1 })); + .Append(mlContext.Ranking.Trainers.FastTree(new FastTreeRankingTrainer.Options { NumberOfThreads = 1 })); // Train the model. var model = pipeline.Fit(data); @@ -247,7 +247,7 @@ public void TrainAndEvaluateRegression() "CrimesPerCapita", "PercentResidental", "PercentNonRetail", "CharlesRiver", "NitricOxides", "RoomsPerDwelling", "PercentPre40s", "EmploymentDistance", "HighwayDistance", "TaxRate", "TeacherRatio"}) .Append(mlContext.Transforms.CopyColumns("Label", "MedianHomeValue")) - .Append(mlContext.Regression.Trainers.FastTree(new FastTreeRegressionTrainer.Options { NumThreads = 1 })); + .Append(mlContext.Regression.Trainers.FastTree(new FastTreeRegressionTrainer.Options { NumberOfThreads = 1 })); // Train the model. var model = pipeline.Fit(data); diff --git a/test/Microsoft.ML.Functional.Tests/Validation.cs b/test/Microsoft.ML.Functional.Tests/Validation.cs index 32694b6d24..4b9ad67ca9 100644 --- a/test/Microsoft.ML.Functional.Tests/Validation.cs +++ b/test/Microsoft.ML.Functional.Tests/Validation.cs @@ -82,7 +82,7 @@ public void TrainWithValidationSet() // Train the model with a validation set. var trainedModel = mlContext.Regression.Trainers.FastTree(new Trainers.FastTree.FastTreeRegressionTrainer.Options { - NumTrees = 2, + NumberOfTrees = 2, EarlyStoppingMetrics = 2, EarlyStoppingRule = new GLEarlyStoppingCriterion.Options() }) diff --git a/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs b/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs index 04c4086425..6fe704e625 100644 --- a/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs +++ b/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs @@ -597,8 +597,8 @@ public void TestTreeEnsembleCombiner() fastTrees[i] = FastTree.TrainBinary(ML, new FastTreeBinaryClassificationTrainer.Options { FeatureColumnName = "Features", - NumTrees = 5, - NumLeaves = 4, + NumberOfTrees = 5, + NumberOfLeaves = 4, LabelColumnName = DefaultColumnNames.Label, TrainingData = dataView }).PredictorModel; @@ -619,8 +619,8 @@ public void TestTreeEnsembleCombinerWithCategoricalSplits() fastTrees[i] = FastTree.TrainBinary(ML, new FastTreeBinaryClassificationTrainer.Options { FeatureColumnName = "Features", - NumTrees = 5, - NumLeaves = 4, + NumberOfTrees = 5, + NumberOfLeaves = 4, CategoricalSplit = true, LabelColumnName = DefaultColumnNames.Label, TrainingData = cat @@ -719,8 +719,8 @@ public void TestEnsembleCombiner() FastTree.TrainBinary(ML, new FastTreeBinaryClassificationTrainer.Options { FeatureColumnName = "Features", - NumTrees = 5, - NumLeaves = 4, + NumberOfTrees = 5, + NumberOfLeaves = 4, LabelColumnName = DefaultColumnNames.Label, TrainingData = dataView }).PredictorModel, diff --git a/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs b/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs index baf8fb6f0c..e5be2e43bc 100644 --- a/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs +++ b/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs @@ -28,9 +28,9 @@ public void FastTreeRegressionRepresentation() var opts = new FastTreeRegressionTrainer.Options() { - NumTrees = 10, - NumLeaves = 5, - NumThreads = 1 + NumberOfTrees = 10, + NumberOfLeaves = 5, + NumberOfThreads = 1 }; FastTreeRegressionModelParameters pred = null; @@ -108,12 +108,12 @@ public void FastTreeRegressionRepresentationWithCategoricalSplit() var opts = new FastTreeRegressionTrainer.Options() { CategoricalSplit = true, - NumTrees = 3, - NumLeaves = 5, - NumThreads = 1, + NumberOfTrees = 3, + NumberOfLeaves = 5, + NumberOfThreads = 1, // This is the minimal samples to form a split (i.e., generating two extra nodes/leaves). For a small data set, // we should set a small value. Otherwise, the trained trees could be empty. - MinDocumentsInLeafs = 2 + MinExampleCountPerLeaf = 2 }; var est = reader.MakeNewEstimator() diff --git a/test/Microsoft.ML.Tests/Scenarios/OvaTest.cs b/test/Microsoft.ML.Tests/Scenarios/OvaTest.cs index b88bf1c176..c6e47bb8eb 100644 --- a/test/Microsoft.ML.Tests/Scenarios/OvaTest.cs +++ b/test/Microsoft.ML.Tests/Scenarios/OvaTest.cs @@ -98,7 +98,7 @@ public void OvaFastTree() // Pipeline var pipeline = mlContext.MulticlassClassification.Trainers.OneVersusAll( - mlContext.BinaryClassification.Trainers.FastTree(new FastTreeBinaryClassificationTrainer.Options { NumThreads = 1 }), + mlContext.BinaryClassification.Trainers.FastTree(new FastTreeBinaryClassificationTrainer.Options { NumberOfThreads = 1 }), useProbabilities: false); var model = pipeline.Fit(data); diff --git a/test/Microsoft.ML.Tests/TrainerEstimators/TreeEnsembleFeaturizerTest.cs b/test/Microsoft.ML.Tests/TrainerEstimators/TreeEnsembleFeaturizerTest.cs index 574b772989..3ee5ffc0a6 100644 --- a/test/Microsoft.ML.Tests/TrainerEstimators/TreeEnsembleFeaturizerTest.cs +++ b/test/Microsoft.ML.Tests/TrainerEstimators/TreeEnsembleFeaturizerTest.cs @@ -24,9 +24,9 @@ public void TreeEnsembleFeaturizerOutputSchemaTest() var trainer = ML.BinaryClassification.Trainers.FastTree( new FastTreeBinaryClassificationTrainer.Options { - NumThreads = 1, - NumTrees = 10, - NumLeaves = 5, + NumberOfThreads = 1, + NumberOfTrees = 10, + NumberOfLeaves = 5, }); // Train the defined tree model. diff --git a/test/Microsoft.ML.Tests/TrainerEstimators/TreeEstimators.cs b/test/Microsoft.ML.Tests/TrainerEstimators/TreeEstimators.cs index 88c8e46e64..e99dafe865 100644 --- a/test/Microsoft.ML.Tests/TrainerEstimators/TreeEstimators.cs +++ b/test/Microsoft.ML.Tests/TrainerEstimators/TreeEstimators.cs @@ -30,9 +30,9 @@ public void FastTreeBinaryEstimator() var trainer = ML.BinaryClassification.Trainers.FastTree( new FastTreeBinaryClassificationTrainer.Options { - NumThreads = 1, - NumTrees = 10, - NumLeaves = 5, + NumberOfThreads = 1, + NumberOfTrees = 10, + NumberOfLeaves = 5, }); var pipeWithTrainer = pipe.Append(trainer); @@ -91,8 +91,8 @@ public void FastForestClassificationEstimator() var trainer = ML.BinaryClassification.Trainers.FastForest( new FastForestClassification.Options { - NumLeaves = 10, - NumTrees = 20, + NumberOfLeaves = 10, + NumberOfTrees = 20, }); var pipeWithTrainer = pipe.Append(trainer); @@ -115,7 +115,7 @@ public void FastTreeRankerEstimator() new FastTreeRankingTrainer.Options { FeatureColumnName = "NumericFeatures", - NumTrees = 10, + NumberOfTrees = 10, RowGroupColumnName = "Group" }); @@ -153,7 +153,7 @@ public void FastTreeRegressorEstimator() { var dataView = GetRegressionPipeline(); var trainer = ML.Regression.Trainers.FastTree( - new FastTreeRegressionTrainer.Options { NumTrees = 10, NumThreads = 1, NumLeaves = 5 }); + new FastTreeRegressionTrainer.Options { NumberOfTrees = 10, NumberOfThreads = 1, NumberOfLeaves = 5 }); TestEstimatorCore(trainer, dataView); var model = trainer.Fit(dataView, dataView); @@ -228,7 +228,7 @@ public void FastForestRegressorEstimator() new FastForestRegression.Options { BaggingSize = 2, - NumTrees = 10, + NumberOfTrees = 10, }); TestEstimatorCore(trainer, dataView); From 099768d835fa22d9b178763877d32f930f705df9 Mon Sep 17 00:00:00 2001 From: Wei-Sheng Chin Date: Wed, 27 Feb 2019 12:51:42 -0800 Subject: [PATCH 02/12] Go through all places once --- .../Dynamic/FastTreeRegression.cs | 2 +- .../Dynamic/GeneralizedAdditiveModels.cs | 6 +- src/Microsoft.ML.FastTree/BoostingFastTree.cs | 2 +- .../FastTreeArguments.cs | 24 ++--- .../FastTreeClassification.cs | 7 +- src/Microsoft.ML.FastTree/FastTreeRanking.cs | 7 +- .../FastTreeRegression.cs | 13 ++- src/Microsoft.ML.FastTree/FastTreeTweedie.cs | 9 +- .../GamClassification.cs | 12 +-- .../GamModelParameters.cs | 101 +++++++++--------- src/Microsoft.ML.FastTree/GamRegression.cs | 6 +- src/Microsoft.ML.FastTree/GamTrainer.cs | 70 ++++++------ src/Microsoft.ML.FastTree/RandomForest.cs | 2 +- .../RandomForestClassification.cs | 13 ++- .../RandomForestRegression.cs | 5 +- .../TreeTrainersCatalog.cs | 73 +++++++------ .../TreeTrainersStatic.cs | 6 +- .../Explainability.cs | 2 +- .../TestGamPublicInterfaces.cs | 13 +-- test/Microsoft.ML.Tests/OnnxConversionTest.cs | 4 +- .../Api/CookbookSamples/CookbookSamples.cs | 2 +- .../CookbookSamplesDynamicApi.cs | 2 +- .../Api/Estimators/IntrospectiveTraining.cs | 2 +- .../TrainerEstimators/TreeEstimators.cs | 4 +- 24 files changed, 191 insertions(+), 196 deletions(-) diff --git a/docs/samples/Microsoft.ML.Samples/Dynamic/FastTreeRegression.cs b/docs/samples/Microsoft.ML.Samples/Dynamic/FastTreeRegression.cs index b40d398165..214435f5d3 100644 --- a/docs/samples/Microsoft.ML.Samples/Dynamic/FastTreeRegression.cs +++ b/docs/samples/Microsoft.ML.Samples/Dynamic/FastTreeRegression.cs @@ -30,7 +30,7 @@ public static void Example() // We will train a FastTreeRegression model with 1 tree on these two columns to predict Age. string outputColumnName = "Features"; var pipeline = ml.Transforms.Concatenate(outputColumnName, new[] { "Parity", "Induced" }) - .Append(ml.Regression.Trainers.FastTree(labelColumnName: "Age", featureColumnName: outputColumnName, numTrees: 1, numLeaves: 2, minDatapointsInLeaves: 1)); + .Append(ml.Regression.Trainers.FastTree(labelColumnName: "Age", featureColumnName: outputColumnName, numberOfTrees: 1, numberOfLeaves: 2, minimumExampleCountPerLeaf: 1)); var model = pipeline.Fit(trainData); diff --git a/docs/samples/Microsoft.ML.Samples/Dynamic/GeneralizedAdditiveModels.cs b/docs/samples/Microsoft.ML.Samples/Dynamic/GeneralizedAdditiveModels.cs index e3edb0813c..0c75071dfa 100644 --- a/docs/samples/Microsoft.ML.Samples/Dynamic/GeneralizedAdditiveModels.cs +++ b/docs/samples/Microsoft.ML.Samples/Dynamic/GeneralizedAdditiveModels.cs @@ -28,7 +28,7 @@ public static void Example() .ToArray(); var pipeline = mlContext.Transforms.Concatenate("Features", featureNames) .Append(mlContext.Regression.Trainers.GeneralizedAdditiveModels( - labelColumnName: labelName, featureColumnName: "Features", maxBins: 16)); + labelColumnName: labelName, featureColumnName: "Features", maxBinCountPerFeature: 16)); var fitPipeline = pipeline.Fit(data); // Extract the model from the pipeline @@ -37,7 +37,7 @@ public static void Example() // Now investigate the properties of the Generalized Additive Model: The intercept and shape functions. // The intercept for the GAM models represent the average prediction for the training data - var intercept = gamModel.Intercept; + var intercept = gamModel.Bias; // Expected output: Average predicted cost: 22.53 Console.WriteLine($"Average predicted cost: {intercept:0.00}"); @@ -93,7 +93,7 @@ public static void Example() // Distillation." arXiv:1710.06169." Console.WriteLine(); Console.WriteLine("Student-Teacher Ratio"); - for (int i = 0; i < teacherRatioBinUpperBounds.Length; i++) + for (int i = 0; i < teacherRatioBinUpperBounds.Count; i++) { Console.WriteLine($"x < {teacherRatioBinUpperBounds[i]:0.00} => {teacherRatioBinEffects[i]:0.000}"); } diff --git a/src/Microsoft.ML.FastTree/BoostingFastTree.cs b/src/Microsoft.ML.FastTree/BoostingFastTree.cs index 27b341d62a..1512e9643a 100644 --- a/src/Microsoft.ML.FastTree/BoostingFastTree.cs +++ b/src/Microsoft.ML.FastTree/BoostingFastTree.cs @@ -162,7 +162,7 @@ private protected override int GetBestIteration(IChannel ch) private protected double BsrMaxTreeOutput() { if (FastTreeTrainerOptions.BestStepRankingRegressionTrees) - return FastTreeTrainerOptions.MaxTreeOutput; + return FastTreeTrainerOptions.MaximumTreeOutput; else return -1; } diff --git a/src/Microsoft.ML.FastTree/FastTreeArguments.cs b/src/Microsoft.ML.FastTree/FastTreeArguments.cs index 74a72dc8da..ad0ffd0d82 100644 --- a/src/Microsoft.ML.FastTree/FastTreeArguments.cs +++ b/src/Microsoft.ML.FastTree/FastTreeArguments.cs @@ -146,7 +146,7 @@ internal static class Defaults { public const int NumberOfTrees = 100; public const int NumberOfLeaves = 20; - public const int MinExampleCountInLeaves = 10; + public const int MinimumExampleCountPerLeaf = 10; public const double LearningRate = 0.2; } @@ -320,7 +320,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId [Argument(ArgumentType.LastOccurenceWins, HelpText = "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", ShortName = "mil,MinDocumentsInLeafs", SortOrder = 3)] [TGUI(Description = "Minimum number of training instances required to form a leaf", SuggestedSweeps = "1,10,50")] [TlcModule.SweepableDiscreteParamAttribute("MinDocumentsInLeafs", new object[] { 1, 10, 50 })] - public int MinExampleCountPerLeaf = Defaults.MinExampleCountInLeaves; + public int MinExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf; /// /// Total number of decision trees to create in the ensemble. @@ -463,13 +463,13 @@ public abstract class BoostedTreeOptions : TreeOptions /// Number of post-bracket line search steps. /// [Argument(ArgumentType.LastOccurenceWins, HelpText = "Number of post-bracket line search steps", ShortName = "lssteps,NumPostBracketSteps")] - public int MaxNumberOfLinearSearchSteps; + public int MaximumNumberOfLineSearchSteps; /// /// Minimum line search step size. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum line search step size", ShortName = "minstep")] - public Double MinStepSize; + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum line search step size", ShortName = "minstep,MinStepSize")] + public Double MinimumStepSize; public enum OptimizationAlgorithmType { GradientDescent, AcceleratedGradientDescent, ConjugateGradientDescent }; @@ -510,7 +510,7 @@ public enum OptimizationAlgorithmType { GradientDescent, AcceleratedGradientDesc /// [Argument(ArgumentType.AtMostOnce, HelpText = "The tolerance threshold for pruning", ShortName = "prth")] [TGUI(Description = "Pruning threshold")] - public Double PruningThreshold = 0.004; + public double PruningThreshold = 0.004; /// /// The moving window size for pruning. @@ -525,7 +525,7 @@ public enum OptimizationAlgorithmType { GradientDescent, AcceleratedGradientDesc [Argument(ArgumentType.LastOccurenceWins, HelpText = "The learning rate", ShortName = "lr,LearningRates", SortOrder = 4)] [TGUI(Label = "Learning Rate", SuggestedSweeps = "0.025-0.4;log")] [TlcModule.SweepableFloatParamAttribute("LearningRates", 0.025f, 0.4f, isLogScale: true)] - public Double LearningRate = Defaults.LearningRate; + public double LearningRate = Defaults.LearningRate; /// /// Shrinkage. @@ -558,8 +558,8 @@ public enum OptimizationAlgorithmType { GradientDescent, AcceleratedGradientDesc /// /// Upper bound on absolute value of single tree output. /// - [Argument(ArgumentType.AtMostOnce, HelpText = "Upper bound on absolute value of single tree output", ShortName = "mo")] - public Double MaxTreeOutput = 100; + [Argument(ArgumentType.AtMostOnce, HelpText = "Upper bound on absolute value of single tree output", ShortName = "mo,MaxTreeOutput")] + public Double MaximumTreeOutput = 100; /// /// Training starts from random ordering (determined by /r1). @@ -630,14 +630,14 @@ internal override void Check(IExceptionContext ectx) { base.Check(ectx); - ectx.CheckUserArg(0 <= MaxTreeOutput, nameof(MaxTreeOutput), "Must be non-negative."); + ectx.CheckUserArg(0 <= MaximumTreeOutput, nameof(MaximumTreeOutput), "Must be non-negative."); ectx.CheckUserArg(0 <= PruningThreshold, nameof(PruningThreshold), "Must be non-negative."); ectx.CheckUserArg(0 < PruningWindowSize, nameof(PruningWindowSize), "Must be positive."); ectx.CheckUserArg(0 < Shrinkage, nameof(Shrinkage), "Must be positive."); ectx.CheckUserArg(0 <= DropoutRate && DropoutRate <= 1, nameof(DropoutRate), "Must be between 0 and 1."); ectx.CheckUserArg(0 < GetDerivativesSampleRate, nameof(GetDerivativesSampleRate), "Must be positive."); - ectx.CheckUserArg(0 <= MaxNumberOfLinearSearchSteps, nameof(MaxNumberOfLinearSearchSteps), "Must be non-negative."); - ectx.CheckUserArg(0 <= MinStepSize, nameof(MinStepSize), "Must be non-negative."); + ectx.CheckUserArg(0 <= MaximumNumberOfLineSearchSteps, nameof(MaximumNumberOfLineSearchSteps), "Must be non-negative."); + ectx.CheckUserArg(0 <= MinimumStepSize, nameof(MinimumStepSize), "Must be non-negative."); } } } diff --git a/src/Microsoft.ML.FastTree/FastTreeClassification.cs b/src/Microsoft.ML.FastTree/FastTreeClassification.cs index a3e2de32ca..d3b50e6135 100644 --- a/src/Microsoft.ML.FastTree/FastTreeClassification.cs +++ b/src/Microsoft.ML.FastTree/FastTreeClassification.cs @@ -10,7 +10,6 @@ using Microsoft.ML.Calibrators; using Microsoft.ML.Data; using Microsoft.ML.EntryPoints; -using Microsoft.ML.Internal.Internallearn; using Microsoft.ML.Model; using Microsoft.ML.Trainers.FastTree; @@ -132,7 +131,7 @@ internal FastTreeBinaryClassificationTrainer(IHostEnvironment env, string weightColumn = null, int numLeaves = Defaults.NumberOfLeaves, int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate) : base(env, TrainerUtils.MakeBoolScalarLabel(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves, learningRate) { @@ -195,7 +194,7 @@ private protected override ObjectiveFunctionBase ConstructObjFunc(IChannel ch) FastTreeTrainerOptions.Shrinkage, _sigmoidParameter, FastTreeTrainerOptions.UnbalancedSets, - FastTreeTrainerOptions.MaxTreeOutput, + FastTreeTrainerOptions.MaximumTreeOutput, FastTreeTrainerOptions.GetDerivativesSampleRate, FastTreeTrainerOptions.BestStepRankingRegressionTrees, FastTreeTrainerOptions.RandomSeed, @@ -209,7 +208,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm( { var lossCalculator = new BinaryClassificationTest(optimizationAlgorithm.TrainingScores, _trainSetLabels, _sigmoidParameter); // REVIEW: we should makeloss indices an enum in BinaryClassificationTest - optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(lossCalculator, FastTreeTrainerOptions.UnbalancedSets ? 3 /*Unbalanced sets loss*/ : 1 /*normal loss*/, FastTreeTrainerOptions.MaxNumberOfLinearSearchSteps, FastTreeTrainerOptions.MinStepSize); + optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(lossCalculator, FastTreeTrainerOptions.UnbalancedSets ? 3 /*Unbalanced sets loss*/ : 1 /*normal loss*/, FastTreeTrainerOptions.MaximumNumberOfLineSearchSteps, FastTreeTrainerOptions.MinimumStepSize); } return optimizationAlgorithm; } diff --git a/src/Microsoft.ML.FastTree/FastTreeRanking.cs b/src/Microsoft.ML.FastTree/FastTreeRanking.cs index fef3f31eaa..48700a1715 100644 --- a/src/Microsoft.ML.FastTree/FastTreeRanking.cs +++ b/src/Microsoft.ML.FastTree/FastTreeRanking.cs @@ -12,7 +12,6 @@ using Microsoft.ML; using Microsoft.ML.Data; using Microsoft.ML.EntryPoints; -using Microsoft.ML.Internal.Internallearn; using Microsoft.ML.Internal.Utilities; using Microsoft.ML.Model; using Microsoft.ML.Trainers.FastTree; @@ -76,7 +75,7 @@ internal FastTreeRankingTrainer(IHostEnvironment env, string weightColumn = null, int numLeaves = Defaults.NumberOfLeaves, int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate) : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, groupIdColumn, numLeaves, numTrees, minDatapointsInLeaves, learningRate) { @@ -193,7 +192,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm( if (FastTreeTrainerOptions.UseLineSearch) { _specialTrainSetTest = new FastNdcgTest(optimizationAlgorithm.TrainingScores, TrainSet.Ratings, FastTreeTrainerOptions.SortingAlgorithm, FastTreeTrainerOptions.EarlyStoppingMetrics); - optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(_specialTrainSetTest, 0, FastTreeTrainerOptions.MaxNumberOfLinearSearchSteps, FastTreeTrainerOptions.MinStepSize); + optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(_specialTrainSetTest, 0, FastTreeTrainerOptions.MaximumNumberOfLineSearchSteps, FastTreeTrainerOptions.MinimumStepSize); } return optimizationAlgorithm; } @@ -554,7 +553,7 @@ public LambdaRankObjectiveFunction(Dataset trainset, short[] labels, Options opt : base(trainset, options.LearningRate, options.Shrinkage, - options.MaxTreeOutput, + options.MaximumTreeOutput, options.GetDerivativesSampleRate, options.BestStepRankingRegressionTrees, options.RandomSeed) diff --git a/src/Microsoft.ML.FastTree/FastTreeRegression.cs b/src/Microsoft.ML.FastTree/FastTreeRegression.cs index 0cbf9124ed..37c1b06622 100644 --- a/src/Microsoft.ML.FastTree/FastTreeRegression.cs +++ b/src/Microsoft.ML.FastTree/FastTreeRegression.cs @@ -8,7 +8,6 @@ using Microsoft.ML; using Microsoft.ML.Data; using Microsoft.ML.EntryPoints; -using Microsoft.ML.Internal.Internallearn; using Microsoft.ML.Model; using Microsoft.ML.Trainers.FastTree; @@ -65,7 +64,7 @@ internal FastTreeRegressionTrainer(IHostEnvironment env, string weightColumn = null, int numLeaves = Defaults.NumberOfLeaves, int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate) : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves, learningRate) { @@ -127,7 +126,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm( { var lossCalculator = new RegressionTest(optimizationAlgorithm.TrainingScores); // REVIEW: We should make loss indices an enum in BinaryClassificationTest. - optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(lossCalculator, 1 /*L2 error*/, FastTreeTrainerOptions.MaxNumberOfLinearSearchSteps, FastTreeTrainerOptions.MinStepSize); + optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(lossCalculator, 1 /*L2 error*/, FastTreeTrainerOptions.MaximumNumberOfLineSearchSteps, FastTreeTrainerOptions.MinimumStepSize); } return optimizationAlgorithm; @@ -390,12 +389,12 @@ internal sealed class ObjectiveImpl : ObjectiveFunctionBase, IStepSearch public ObjectiveImpl(Dataset trainData, RegressionGamTrainer.Options options) : base( trainData, - options.LearningRates, + options.LearningRate, 0, - options.MaxOutput, + options.MaximumTreeOutput, options.GetDerivativesSampleRate, false, - options.RngSeed) + options.Seed) { _labels = GetDatasetRegressionLabels(trainData); } @@ -405,7 +404,7 @@ public ObjectiveImpl(Dataset trainData, Options options) trainData, options.LearningRate, options.Shrinkage, - options.MaxTreeOutput, + options.MaximumTreeOutput, options.GetDerivativesSampleRate, options.BestStepRankingRegressionTrees, options.RandomSeed) diff --git a/src/Microsoft.ML.FastTree/FastTreeTweedie.cs b/src/Microsoft.ML.FastTree/FastTreeTweedie.cs index 9fdc0301e3..d92789583b 100644 --- a/src/Microsoft.ML.FastTree/FastTreeTweedie.cs +++ b/src/Microsoft.ML.FastTree/FastTreeTweedie.cs @@ -9,7 +9,6 @@ using Microsoft.ML; using Microsoft.ML.Data; using Microsoft.ML.EntryPoints; -using Microsoft.ML.Internal.Internallearn; using Microsoft.ML.Internal.Utilities; using Microsoft.ML.Model; using Microsoft.ML.Trainers.FastTree; @@ -63,7 +62,7 @@ internal FastTreeTweedieTrainer(IHostEnvironment env, string weightColumn = null, int numLeaves = Defaults.NumberOfLeaves, int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate) : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves, learningRate) { @@ -134,7 +133,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm( var lossCalculator = new RegressionTest(optimizationAlgorithm.TrainingScores); // REVIEW: We should make loss indices an enum in BinaryClassificationTest. // REVIEW: Nope, subcomponent. - optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(lossCalculator, 1 /*L2 error*/, FastTreeTrainerOptions.MaxNumberOfLinearSearchSteps, FastTreeTrainerOptions.MinStepSize); + optimizationAlgorithm.AdjustTreeOutputsOverride = new LineSearch(lossCalculator, 1 /*L2 error*/, FastTreeTrainerOptions.MaximumNumberOfLineSearchSteps, FastTreeTrainerOptions.MinimumStepSize); } return optimizationAlgorithm; @@ -343,7 +342,7 @@ public ObjectiveImpl(Dataset trainData, Options options) trainData, options.LearningRate, options.Shrinkage, - options.MaxTreeOutput, + options.MaximumTreeOutput, options.GetDerivativesSampleRate, options.BestStepRankingRegressionTrees, options.RandomSeed) @@ -361,7 +360,7 @@ public ObjectiveImpl(Dataset trainData, Options options) _index1 = 1 - options.Index; _index2 = 2 - options.Index; - _maxClamp = Math.Abs(options.MaxTreeOutput); + _maxClamp = Math.Abs(options.MaximumTreeOutput); } public void AdjustTreeOutputs(IChannel ch, InternalRegressionTree tree, DocumentPartitioning partitioning, ScoreTracker trainingScores) diff --git a/src/Microsoft.ML.FastTree/GamClassification.cs b/src/Microsoft.ML.FastTree/GamClassification.cs index ba75b315d6..eb28919742 100644 --- a/src/Microsoft.ML.FastTree/GamClassification.cs +++ b/src/Microsoft.ML.FastTree/GamClassification.cs @@ -69,9 +69,9 @@ internal BinaryClassificationGamTrainer(IHostEnvironment env, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, string weightColumn = null, - int numIterations = GamDefaults.NumIterations, - double learningRate = GamDefaults.LearningRates, - int maxBins = GamDefaults.MaxBins) + int numIterations = GamDefaults.NumberOfIterations, + double learningRate = GamDefaults.LearningRate, + int maxBins = GamDefaults.MaximumBinCountPerFeature) : base(env, LoadNameValue, TrainerUtils.MakeBoolScalarLabel(labelColumn), featureColumn, weightColumn, numIterations, learningRate, maxBins) { _sigmoidParameter = 1; @@ -115,14 +115,14 @@ private protected override ObjectiveFunctionBase CreateObjectiveFunction() return new FastTreeBinaryClassificationTrainer.ObjectiveImpl( TrainSet, ConvertTargetsToBool(TrainSet.Targets), - GamTrainerOptions.LearningRates, + GamTrainerOptions.LearningRate, 0, _sigmoidParameter, GamTrainerOptions.UnbalancedSets, - GamTrainerOptions.MaxOutput, + GamTrainerOptions.MaximumTreeOutput, GamTrainerOptions.GetDerivativesSampleRate, false, - GamTrainerOptions.RngSeed, + GamTrainerOptions.Seed, ParallelTraining ); } diff --git a/src/Microsoft.ML.FastTree/GamModelParameters.cs b/src/Microsoft.ML.FastTree/GamModelParameters.cs index 091de95de9..8ddc66f833 100644 --- a/src/Microsoft.ML.FastTree/GamModelParameters.cs +++ b/src/Microsoft.ML.FastTree/GamModelParameters.cs @@ -13,7 +13,6 @@ using Microsoft.ML.Command; using Microsoft.ML.CommandLine; using Microsoft.ML.Data; -using Microsoft.ML.Internal.Internallearn; using Microsoft.ML.Internal.Utilities; using Microsoft.ML.Model; using Microsoft.ML.Trainers.FastTree; @@ -30,23 +29,23 @@ namespace Microsoft.ML.Trainers.FastTree public abstract class GamModelParametersBase : ModelParametersBase, IValueMapper, ICalculateFeatureContribution, IFeatureContributionMapper, ICanSaveInTextFormat, ICanSaveSummary, ICanSaveInIniFormat { - private readonly double[][] _binUpperBounds; - private readonly double[][] _binEffects; /// /// The model intercept. Also known as bias or mean effect. /// - public readonly double Intercept; + public readonly double Bias; /// /// The number of shape functions used in the model. /// - public readonly int NumShapeFunctions; + public readonly int NumberOfShapeFunctions; + + private readonly double[][] _binUpperBounds; + private readonly double[][] _binEffects; private readonly VectorType _inputType; private readonly DataViewType _outputType; // These would be the bins for a totally sparse input. private readonly int[] _binsAtAllZero; // The output value for all zeros private readonly double _valueAtAllZero; - private readonly int[] _shapeToInputMap; private readonly int _numInputFeatures; private readonly Dictionary _inputFeatureToShapeFunctionMap; @@ -73,17 +72,17 @@ private protected GamModelParametersBase(IHostEnvironment env, string name, Host.CheckParam(shapeToInputMap == null || shapeToInputMap.Length == binEffects.Length, nameof(shapeToInputMap), "Must have same number of features as binEffects"); // Define the model basics - Intercept = intercept; + Bias = intercept; _binUpperBounds = binUpperBounds; _binEffects = binEffects; - NumShapeFunctions = binEffects.Length; + NumberOfShapeFunctions = binEffects.Length; // For sparse inputs we have a fast lookup - _binsAtAllZero = new int[NumShapeFunctions]; + _binsAtAllZero = new int[NumberOfShapeFunctions]; _valueAtAllZero = 0; // Walk through each feature and perform checks / updates - for (int i = 0; i < NumShapeFunctions; i++) + for (int i = 0; i < NumberOfShapeFunctions; i++) { // Check data validity Host.CheckValue(binEffects[i], nameof(binEffects), "Array contained null entries"); @@ -97,11 +96,11 @@ private protected GamModelParametersBase(IHostEnvironment env, string name, // Define the sparse mappings from/to input to/from shape functions _shapeToInputMap = shapeToInputMap; if (_shapeToInputMap == null) - _shapeToInputMap = Utils.GetIdentityPermutation(NumShapeFunctions); + _shapeToInputMap = Utils.GetIdentityPermutation(NumberOfShapeFunctions); _numInputFeatures = numInputFeatures; if (_numInputFeatures == -1) - _numInputFeatures = NumShapeFunctions; + _numInputFeatures = NumberOfShapeFunctions; _inputFeatureToShapeFunctionMap = new Dictionary(_shapeToInputMap.Length); for (int i = 0; i < _shapeToInputMap.Length; i++) { @@ -121,24 +120,24 @@ private protected GamModelParametersBase(IHostEnvironment env, string name, Mode BinaryReader reader = ctx.Reader; - NumShapeFunctions = reader.ReadInt32(); - Host.CheckDecode(NumShapeFunctions >= 0); + NumberOfShapeFunctions = reader.ReadInt32(); + Host.CheckDecode(NumberOfShapeFunctions >= 0); _numInputFeatures = reader.ReadInt32(); Host.CheckDecode(_numInputFeatures >= 0); - Intercept = reader.ReadDouble(); + Bias = reader.ReadDouble(); if (ctx.Header.ModelVerWritten == 0x00010001) using (var ch = env.Start("GamWarningChannel")) ch.Warning("GAMs models written prior to ML.NET 0.6 are loaded with an incorrect Intercept. For these models, subtract the value of the intercept from the prediction."); - _binEffects = new double[NumShapeFunctions][]; - _binUpperBounds = new double[NumShapeFunctions][]; - _binsAtAllZero = new int[NumShapeFunctions]; - for (int i = 0; i < NumShapeFunctions; i++) + _binEffects = new double[NumberOfShapeFunctions][]; + _binUpperBounds = new double[NumberOfShapeFunctions][]; + _binsAtAllZero = new int[NumberOfShapeFunctions]; + for (int i = 0; i < NumberOfShapeFunctions; i++) { _binEffects[i] = reader.ReadDoubleArray(); Host.CheckDecode(Utils.Size(_binEffects[i]) >= 1); } - for (int i = 0; i < NumShapeFunctions; i++) + for (int i = 0; i < NumberOfShapeFunctions; i++) { _binUpperBounds[i] = reader.ReadDoubleArray(_binEffects[i].Length); _valueAtAllZero += GetBinEffect(i, 0, out _binsAtAllZero[i]); @@ -147,13 +146,13 @@ private protected GamModelParametersBase(IHostEnvironment env, string name, Mode Host.CheckDecode(len >= 0); _inputFeatureToShapeFunctionMap = new Dictionary(len); - _shapeToInputMap = Utils.CreateArray(NumShapeFunctions, -1); + _shapeToInputMap = Utils.CreateArray(NumberOfShapeFunctions, -1); for (int i = 0; i < len; i++) { int key = reader.ReadInt32(); Host.CheckDecode(0 <= key && key < _numInputFeatures); int val = reader.ReadInt32(); - Host.CheckDecode(0 <= val && val < NumShapeFunctions); + Host.CheckDecode(0 <= val && val < NumberOfShapeFunctions); Host.CheckDecode(!_inputFeatureToShapeFunctionMap.ContainsKey(key)); Host.CheckDecode(_shapeToInputMap[val] == -1); _inputFeatureToShapeFunctionMap[key] = val; @@ -168,17 +167,17 @@ private protected override void SaveCore(ModelSaveContext ctx) { Host.CheckValue(ctx, nameof(ctx)); - ctx.Writer.Write(NumShapeFunctions); - Host.Assert(NumShapeFunctions >= 0); + ctx.Writer.Write(NumberOfShapeFunctions); + Host.Assert(NumberOfShapeFunctions >= 0); ctx.Writer.Write(_numInputFeatures); Host.Assert(_numInputFeatures >= 0); - ctx.Writer.Write(Intercept); - for (int i = 0; i < NumShapeFunctions; i++) + ctx.Writer.Write(Bias); + for (int i = 0; i < NumberOfShapeFunctions; i++) ctx.Writer.WriteDoubleArray(_binEffects[i]); int diff = _binEffects.Sum(e => e.Take(e.Length - 1).Select((ef, i) => ef != e[i + 1] ? 1 : 0).Sum()); int bound = _binEffects.Sum(e => e.Length - 1); - for (int i = 0; i < NumShapeFunctions; i++) + for (int i = 0; i < NumberOfShapeFunctions; i++) { ctx.Writer.WriteDoublesNoCount(_binUpperBounds[i]); Host.Assert(_binUpperBounds[i].Length == _binEffects[i].Length); @@ -204,7 +203,7 @@ private void Map(in VBuffer features, ref float response) { Host.CheckParam(features.Length == _numInputFeatures, nameof(features), "Bad length of input"); - double value = Intercept; + double value = Bias; var featuresValues = features.GetValues(); if (features.IsDense) @@ -234,9 +233,9 @@ private void Map(in VBuffer features, ref float response) internal double GetFeatureBinsAndScore(in VBuffer features, int[] bins) { Host.CheckParam(features.Length == _numInputFeatures, nameof(features)); - Host.CheckParam(Utils.Size(bins) == NumShapeFunctions, nameof(bins)); + Host.CheckParam(Utils.Size(bins) == NumberOfShapeFunctions, nameof(bins)); - double value = Intercept; + double value = Bias; var featuresValues = features.GetValues(); if (features.IsDense) { @@ -251,7 +250,7 @@ internal double GetFeatureBinsAndScore(in VBuffer features, int[] bins) var featuresIndices = features.GetIndices(); // Add in the precomputed results for all features value += _valueAtAllZero; - Array.Copy(_binsAtAllZero, bins, NumShapeFunctions); + Array.Copy(_binsAtAllZero, bins, NumberOfShapeFunctions); // Update the results for features we have for (int i = 0; i < featuresValues.Length; ++i) @@ -266,14 +265,14 @@ internal double GetFeatureBinsAndScore(in VBuffer features, int[] bins) private double GetBinEffect(int featureIndex, double featureValue) { - Host.Assert(0 <= featureIndex && featureIndex < NumShapeFunctions, "Index out of range."); + Host.Assert(0 <= featureIndex && featureIndex < NumberOfShapeFunctions, "Index out of range."); int index = Algorithms.FindFirstGE(_binUpperBounds[featureIndex], featureValue); return _binEffects[featureIndex][index]; } private double GetBinEffect(int featureIndex, double featureValue, out int binIndex) { - Host.Check(0 <= featureIndex && featureIndex < NumShapeFunctions, "Index out of range."); + Host.Check(0 <= featureIndex && featureIndex < NumberOfShapeFunctions, "Index out of range."); binIndex = Algorithms.FindFirstGE(_binUpperBounds[featureIndex], featureValue); return _binEffects[featureIndex][binIndex]; } @@ -283,9 +282,9 @@ private double GetBinEffect(int featureIndex, double featureValue, out int binIn /// /// The index of the feature (in the training vector) to get. /// The bin upper bounds. May be zero length if this feature has no bins. - public double[] GetBinUpperBounds(int featureIndex) + public IReadOnlyList GetBinUpperBounds(int featureIndex) { - Host.Check(0 <= featureIndex && featureIndex < NumShapeFunctions, "Index out of range."); + Host.Check(0 <= featureIndex && featureIndex < NumberOfShapeFunctions, "Index out of range."); if (!_inputFeatureToShapeFunctionMap.TryGetValue(featureIndex, out int j)) return new double[0]; @@ -297,10 +296,11 @@ public double[] GetBinUpperBounds(int featureIndex) /// /// Get all the bin upper bounds. /// - public double[][] GetBinUpperBounds() + [BestFriend] + internal double[][] GetBinUpperBounds() { - double[][] binUpperBounds = new double[NumShapeFunctions][]; - for (int i = 0; i < NumShapeFunctions; i++) + double[][] binUpperBounds = new double[NumberOfShapeFunctions][]; + for (int i = 0; i < NumberOfShapeFunctions; i++) { if (_inputFeatureToShapeFunctionMap.TryGetValue(i, out int j)) { @@ -320,9 +320,9 @@ public double[][] GetBinUpperBounds() /// /// The index of the feature (in the training vector) to get. /// The binned effects for each feature. May be zero length if this feature has no bins. - public double[] GetBinEffects(int featureIndex) + public IReadOnlyList GetBinEffects(int featureIndex) { - Host.Check(0 <= featureIndex && featureIndex < NumShapeFunctions, "Index out of range."); + Host.Check(0 <= featureIndex && featureIndex < NumberOfShapeFunctions, "Index out of range."); if (!_inputFeatureToShapeFunctionMap.TryGetValue(featureIndex, out int j)) return new double[0]; @@ -334,10 +334,11 @@ public double[] GetBinEffects(int featureIndex) /// /// Get all the binned effects. /// - public double[][] GetBinEffects() + [BestFriend] + internal double[][] GetBinEffects() { - double[][] binEffects = new double[NumShapeFunctions][]; - for (int i = 0; i < NumShapeFunctions; i++) + double[][] binEffects = new double[NumberOfShapeFunctions][]; + for (int i = 0; i < NumberOfShapeFunctions; i++) { if (_inputFeatureToShapeFunctionMap.TryGetValue(i, out int j)) { @@ -358,7 +359,7 @@ void ICanSaveInTextFormat.SaveAsText(TextWriter writer, RoleMappedSchema schema) Host.CheckValueOrNull(schema); writer.WriteLine("\xfeffFeature index table"); // add BOM to tell excel this is UTF-8 - writer.WriteLine($"Number of features:\t{NumShapeFunctions + 1:D}"); + writer.WriteLine($"Number of features:\t{NumberOfShapeFunctions + 1:D}"); writer.WriteLine("Feature Index\tFeature Name"); // REVIEW: We really need some unit tests around text exporting (for this, and other learners). @@ -371,7 +372,7 @@ void ICanSaveInTextFormat.SaveAsText(TextWriter writer, RoleMappedSchema schema) var names = default(VBuffer>); AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, _numInputFeatures, ref names); - for (int internalIndex = 0; internalIndex < NumShapeFunctions; internalIndex++) + for (int internalIndex = 0; internalIndex < NumberOfShapeFunctions; internalIndex++) { int featureIndex = _shapeToInputMap[internalIndex]; var name = names.GetItemOrDefault(featureIndex); @@ -381,8 +382,8 @@ void ICanSaveInTextFormat.SaveAsText(TextWriter writer, RoleMappedSchema schema) writer.WriteLine(); writer.WriteLine("Per feature binned effects:"); writer.WriteLine("Feature Index\tFeature Value Bin Upper Bound\tOutput (effect on label)"); - writer.WriteLine($"{-1:D}\t{float.MaxValue:R}\t{Intercept:R}"); - for (int internalIndex = 0; internalIndex < NumShapeFunctions; internalIndex++) + writer.WriteLine($"{-1:D}\t{float.MaxValue:R}\t{Bias:R}"); + for (int internalIndex = 0; internalIndex < NumberOfShapeFunctions; internalIndex++) { int featureIndex = _shapeToInputMap[internalIndex]; @@ -437,7 +438,7 @@ void ICanSaveInIniFormat.SaveAsIni(TextWriter writer, RoleMappedSchema schema, I Host.CheckValue(writer, nameof(writer), "writer must not be null"); var ensemble = new InternalTreeEnsemble(); - for (int featureIndex = 0; featureIndex < NumShapeFunctions; featureIndex++) + for (int featureIndex = 0; featureIndex < NumberOfShapeFunctions; featureIndex++) { var effects = _binEffects[featureIndex]; var binThresholds = _binUpperBounds[featureIndex]; @@ -460,7 +461,7 @@ void ICanSaveInIniFormat.SaveAsIni(TextWriter writer, RoleMappedSchema schema, I rawThresholds: new[] { 0f }, lteChild: new[] { ~0 }, gtChild: new[] { ~1 }, - leafValues: new[] { Intercept, Intercept }); + leafValues: new[] { Bias, Bias }); ensemble.AddTree(interceptTree); var ini = FastTreeIniFileUtils.TreeEnsembleToIni( @@ -852,7 +853,7 @@ public static FeatureInfo[] GetInfos(Context context) { lock (context._pred) { - return Utils.BuildArray(context._pred.NumShapeFunctions, + return Utils.BuildArray(context._pred.NumberOfShapeFunctions, i => new FeatureInfo(context, context._pred._shapeToInputMap[i], i, context._catsMap)); } } diff --git a/src/Microsoft.ML.FastTree/GamRegression.cs b/src/Microsoft.ML.FastTree/GamRegression.cs index fc27185c02..b3eac9b401 100644 --- a/src/Microsoft.ML.FastTree/GamRegression.cs +++ b/src/Microsoft.ML.FastTree/GamRegression.cs @@ -55,9 +55,9 @@ internal RegressionGamTrainer(IHostEnvironment env, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, string weightColumn = null, - int numIterations = GamDefaults.NumIterations, - double learningRate = GamDefaults.LearningRates, - int maxBins = GamDefaults.MaxBins) + int numIterations = GamDefaults.NumberOfIterations, + double learningRate = GamDefaults.LearningRate, + int maxBins = GamDefaults.MaximumBinCountPerFeature) : base(env, LoadNameValue, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, numIterations, learningRate, maxBins) { } diff --git a/src/Microsoft.ML.FastTree/GamTrainer.cs b/src/Microsoft.ML.FastTree/GamTrainer.cs index 214a661000..34f5b7e24f 100644 --- a/src/Microsoft.ML.FastTree/GamTrainer.cs +++ b/src/Microsoft.ML.FastTree/GamTrainer.cs @@ -63,38 +63,38 @@ public abstract class OptionsBase : TrainerInputBaseWithWeight [Argument(ArgumentType.LastOccurenceWins, HelpText = "Tree fitting gain confidence requirement (should be in the range [0,1) ).", ShortName = "gainconf")] public int GainConfidenceLevel; - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Total number of iterations over all features", ShortName = "iter", SortOrder = 1)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Total number of iterations over all features", ShortName = "iter,NumIterations", SortOrder = 1)] [TGUI(SuggestedSweeps = "200,1500,9500")] [TlcModule.SweepableDiscreteParamAttribute("NumIterations", new object[] { 200, 1500, 9500 })] - public int NumIterations = GamDefaults.NumIterations; + public int NumberOfIterations = GamDefaults.NumberOfIterations; - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The number of threads to use", ShortName = "t", NullName = "")] - public int? NumThreads = null; + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The number of threads to use", ShortName = "t,NumThreads", NullName = "")] + public int? NumberOfThreads = null; - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The learning rate", ShortName = "lr", SortOrder = 4)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The learning rate", ShortName = "lr,LearningRates", SortOrder = 4)] [TGUI(SuggestedSweeps = "0.001,0.1;log")] [TlcModule.SweepableFloatParamAttribute("LearningRates", 0.001f, 0.1f, isLogScale: true)] - public double LearningRates = GamDefaults.LearningRates; + public double LearningRate = GamDefaults.LearningRate; [Argument(ArgumentType.LastOccurenceWins, HelpText = "Whether to utilize the disk or the data's native transposition facilities (where applicable) when performing the transpose", ShortName = "dt")] public bool? DiskTranspose; - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum number of distinct values (bins) per feature", ShortName = "mb")] - public int MaxBins = GamDefaults.MaxBins; + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum number of distinct values (bins) per feature", ShortName = "mb,MaxBins")] + public int MaximumBinCountPerFeature = GamDefaults.MaximumBinCountPerFeature; - [Argument(ArgumentType.AtMostOnce, HelpText = "Upper bound on absolute value of single output", ShortName = "mo")] - public double MaxOutput = Double.PositiveInfinity; + [Argument(ArgumentType.AtMostOnce, HelpText = "Upper bound on absolute value of single output", ShortName = "mo,MaxOutput")] + public double MaximumTreeOutput = double.PositiveInfinity; [Argument(ArgumentType.AtMostOnce, HelpText = "Sample each query 1 in k times in the GetDerivatives function", ShortName = "sr")] public int GetDerivativesSampleRate = 1; - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The seed of the random number generator", ShortName = "r1")] - public int RngSeed = 123; + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The seed of the random number generator", ShortName = "r1,RngSeed")] + public int Seed = 123; - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum number of training instances required to form a partition", ShortName = "mi", SortOrder = 3)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum number of training instances required to form a partition", ShortName = "mi,MinDocuments", SortOrder = 3)] [TGUI(SuggestedSweeps = "1,10,50")] [TlcModule.SweepableDiscreteParamAttribute("MinDocuments", new object[] { 1, 10, 50 })] - public int MinDocuments = 10; + public int MinimumExampleCountPerLeaf = 10; [Argument(ArgumentType.LastOccurenceWins, HelpText = "Whether to collectivize features during dataset preparation to speed up training", ShortName = "flocks", Hide = true)] public bool FeatureFlocks = true; @@ -156,9 +156,9 @@ private protected GamTrainerBase(IHostEnvironment env, : base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(featureColumn), label, TrainerUtils.MakeR4ScalarWeightColumn(weightColumn)) { GamTrainerOptions = new TOptions(); - GamTrainerOptions.NumIterations = numIterations; - GamTrainerOptions.LearningRates = learningRate; - GamTrainerOptions.MaxBins = maxBins; + GamTrainerOptions.NumberOfIterations = numIterations; + GamTrainerOptions.LearningRate = learningRate; + GamTrainerOptions.MaximumBinCountPerFeature = maxBins; GamTrainerOptions.LabelColumnName = label.Name; GamTrainerOptions.FeatureColumnName = featureColumn; @@ -180,13 +180,13 @@ private protected GamTrainerBase(IHostEnvironment env, TOptions options, string Contracts.CheckValue(env, nameof(env)); Host.CheckValue(options, nameof(options)); - Host.CheckParam(options.LearningRates > 0, nameof(options.LearningRates), "Must be positive."); - Host.CheckParam(options.NumThreads == null || options.NumThreads > 0, nameof(options.NumThreads), "Must be positive."); + Host.CheckParam(options.LearningRate > 0, nameof(options.LearningRate), "Must be positive."); + Host.CheckParam(options.NumberOfThreads == null || options.NumberOfThreads > 0, nameof(options.NumberOfThreads), "Must be positive."); Host.CheckParam(0 <= options.EntropyCoefficient && options.EntropyCoefficient <= 1, nameof(options.EntropyCoefficient), "Must be in [0, 1]."); Host.CheckParam(0 <= options.GainConfidenceLevel && options.GainConfidenceLevel < 1, nameof(options.GainConfidenceLevel), "Must be in [0, 1)."); - Host.CheckParam(0 < options.MaxBins, nameof(options.MaxBins), "Must be posittive."); - Host.CheckParam(0 < options.NumIterations, nameof(options.NumIterations), "Must be positive."); - Host.CheckParam(0 < options.MinDocuments, nameof(options.MinDocuments), "Must be positive."); + Host.CheckParam(0 < options.MaximumBinCountPerFeature, nameof(options.MaximumBinCountPerFeature), "Must be posittive."); + Host.CheckParam(0 < options.NumberOfIterations, nameof(options.NumberOfIterations), "Must be positive."); + Host.CheckParam(0 < options.MinimumExampleCountPerLeaf, nameof(options.MinimumExampleCountPerLeaf), "Must be positive."); GamTrainerOptions = options; @@ -234,7 +234,7 @@ private void ConvertData(RoleMappedData trainData, RoleMappedData validationData CheckLabel(trainData); var useTranspose = UseTranspose(GamTrainerOptions.DiskTranspose, trainData); - var instanceConverter = new ExamplesToFastTreeBins(Host, GamTrainerOptions.MaxBins, useTranspose, !GamTrainerOptions.FeatureFlocks, GamTrainerOptions.MinDocuments, float.PositiveInfinity); + var instanceConverter = new ExamplesToFastTreeBins(Host, GamTrainerOptions.MaximumBinCountPerFeature, useTranspose, !GamTrainerOptions.FeatureFlocks, GamTrainerOptions.MinimumExampleCountPerLeaf, float.PositiveInfinity); ParallelTraining.InitEnvironment(); TrainSet = instanceConverter.FindBinsAndReturnDataset(trainData, PredictionKind, ParallelTraining, null, false); @@ -274,7 +274,7 @@ private void TrainCore(IChannel ch) private void TrainMainEffectsModel(IChannel ch) { Contracts.AssertValue(ch); - int iterations = GamTrainerOptions.NumIterations; + int iterations = GamTrainerOptions.NumberOfIterations; ch.Info("Starting to train ..."); @@ -340,7 +340,7 @@ private void TrainingIteration(int globalFeatureIndex, double[] gradient, double // Compute the split for the feature _histogram[flockIndex].FindBestSplitForFeature(_leafSplitHelper, _leafSplitCandidates, _leafSplitCandidates.Targets.Length, sumTargets, sumWeights, - globalFeatureIndex, flockIndex, subFeatureIndex, GamTrainerOptions.MinDocuments, HasWeights, + globalFeatureIndex, flockIndex, subFeatureIndex, GamTrainerOptions.MinimumExampleCountPerLeaf, HasWeights, _gainConfidenceInSquaredStandardDeviations, _entropyCoefficient, TrainSet.Flocks[flockIndex].Trust(subFeatureIndex), 0); @@ -403,7 +403,7 @@ private void UpdateScoresForSet(Dataset dataset, double[] scores, int iteration) private void CombineGraphs(IChannel ch) { // Prune backwards to the best iteration - int bestIteration = GamTrainerOptions.NumIterations; + int bestIteration = GamTrainerOptions.NumberOfIterations; if (GamTrainerOptions.EnablePruning && PruningTest != null) { ch.Info("Pruning"); @@ -415,8 +415,8 @@ private void CombineGraphs(IChannel ch) bestIteration = PruningTest.BestIteration; bestLoss = PruningTest.BestResult.FinalValue; } - if (bestIteration != GamTrainerOptions.NumIterations) - ch.Info($"Best Iteration ({lossFunctionName}): {bestIteration} @ {bestLoss:G6} (vs {GamTrainerOptions.NumIterations} @ {finalResult.FinalValue:G6})."); + if (bestIteration != GamTrainerOptions.NumberOfIterations) + ch.Info($"Best Iteration ({lossFunctionName}): {bestIteration} @ {bestLoss:G6} (vs {GamTrainerOptions.NumberOfIterations} @ {finalResult.FinalValue:G6})."); else ch.Info("No pruning necessary. More iterations may be necessary."); } @@ -556,8 +556,8 @@ private void ConvertTreeToGraph(int globalFeatureIndex, int iteration) { SplitInfo splitinfo = _leafSplitCandidates.FeatureSplitInfo[globalFeatureIndex]; _subGraph.Splits[globalFeatureIndex][iteration].SplitPoint = splitinfo.Threshold; - _subGraph.Splits[globalFeatureIndex][iteration].LteValue = GamTrainerOptions.LearningRates * splitinfo.LteOutput; - _subGraph.Splits[globalFeatureIndex][iteration].GtValue = GamTrainerOptions.LearningRates * splitinfo.GTOutput; + _subGraph.Splits[globalFeatureIndex][iteration].LteValue = GamTrainerOptions.LearningRate * splitinfo.LteOutput; + _subGraph.Splits[globalFeatureIndex][iteration].GtValue = GamTrainerOptions.LearningRate * splitinfo.GTOutput; } private void InitializeGamHistograms() @@ -572,7 +572,7 @@ private void Initialize(IChannel ch) using (Timer.Time(TimerEvent.InitializeTraining)) { InitializeGamHistograms(); - _subGraph = new SubGraph(TrainSet.NumFeatures, GamTrainerOptions.NumIterations); + _subGraph = new SubGraph(TrainSet.NumFeatures, GamTrainerOptions.NumberOfIterations); _leafSplitCandidates = new LeastSquaresRegressionTreeLearner.LeafSplitCandidates(TrainSet); _leafSplitHelper = new LeafSplitHelper(HasWeights); } @@ -582,7 +582,7 @@ private void InitializeThreads() { ParallelTraining = new SingleTrainer(); - int numThreads = GamTrainerOptions.NumThreads ?? Environment.ProcessorCount; + int numThreads = GamTrainerOptions.NumberOfThreads ?? Environment.ProcessorCount; if (Host.ConcurrencyFactor > 0 && numThreads > Host.ConcurrencyFactor) using (var ch = Host.Start("GamTrainer")) { @@ -703,8 +703,8 @@ public static CommonOutputs.BinaryClassificationOutput TrainBinary(IHostEnvironm internal static class GamDefaults { - internal const int NumIterations = 9500; - internal const int MaxBins = 255; - internal const double LearningRates = 0.002; // A small value + internal const int NumberOfIterations = 9500; + internal const int MaximumBinCountPerFeature = 255; + internal const double LearningRate = 0.002; // A small value } } diff --git a/src/Microsoft.ML.FastTree/RandomForest.cs b/src/Microsoft.ML.FastTree/RandomForest.cs index 684039fb7b..c4d53ff9a7 100644 --- a/src/Microsoft.ML.FastTree/RandomForest.cs +++ b/src/Microsoft.ML.FastTree/RandomForest.cs @@ -65,7 +65,7 @@ private protected override TreeLearner ConstructTreeLearner(IChannel ch) FastTreeTrainerOptions.FeatureFirstUsePenalty, FastTreeTrainerOptions.FeatureReusePenalty, FastTreeTrainerOptions.SoftmaxTemperature, FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.RandomSeed, FastTreeTrainerOptions.FeatureFractionPerSplit, FastTreeTrainerOptions.AllowEmptyTrees, FastTreeTrainerOptions.GainConfidenceLevel, FastTreeTrainerOptions.MaxCategoricalGroupsPerNode, - FastTreeTrainerOptions.MaxCategoricalSplitPoints, _quantileEnabled, FastTreeTrainerOptions.QuantileSampleCount, ParallelTraining, + FastTreeTrainerOptions.MaxCategoricalSplitPoints, _quantileEnabled, FastTreeTrainerOptions.NumberOfQuantileSamples, ParallelTraining, FastTreeTrainerOptions.MinExamplePercentageForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinExamplesForCategoricalSplit, FastTreeTrainerOptions.Bias); } diff --git a/src/Microsoft.ML.FastTree/RandomForestClassification.cs b/src/Microsoft.ML.FastTree/RandomForestClassification.cs index 0ad6268f80..3a17f1f47e 100644 --- a/src/Microsoft.ML.FastTree/RandomForestClassification.cs +++ b/src/Microsoft.ML.FastTree/RandomForestClassification.cs @@ -10,7 +10,6 @@ using Microsoft.ML.CommandLine; using Microsoft.ML.Data; using Microsoft.ML.EntryPoints; -using Microsoft.ML.Internal.Internallearn; using Microsoft.ML.Model; using Microsoft.ML.Trainers.FastTree; @@ -32,8 +31,8 @@ namespace Microsoft.ML.Trainers.FastTree { public abstract class FastForestOptionsBase : TreeOptions { - [Argument(ArgumentType.AtMostOnce, HelpText = "Number of labels to be sampled from each leaf to make the distribtuion", ShortName = "qsc")] - public int QuantileSampleCount = 100; + [Argument(ArgumentType.AtMostOnce, HelpText = "Number of labels to be sampled from each leaf to make the distribtuion", ShortName = "qsc,QuantileSampleCount")] + public int NumberOfQuantileSamples = 100; public FastForestOptionsBase() { @@ -111,8 +110,8 @@ public sealed partial class FastForestClassification : { public sealed class Options : FastForestOptionsBase { - [Argument(ArgumentType.AtMostOnce, HelpText = "Upper bound on absolute value of single tree output", ShortName = "mo")] - public Double MaxTreeOutput = 100; + [Argument(ArgumentType.AtMostOnce, HelpText = "Upper bound on absolute value of single tree output", ShortName = "mo,MaxTreeOutput")] + public Double MaximumOutputMagnitudePerTree = 100; [Argument(ArgumentType.AtMostOnce, HelpText = "The calibrator kind to apply to the predictor. Specify null for no calibration", Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] internal ICalibratorTrainerFactory Calibrator = new PlattCalibratorTrainerFactory(); @@ -147,7 +146,7 @@ internal FastForestClassification(IHostEnvironment env, string weightColumn = null, int numLeaves = Defaults.NumberOfLeaves, int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves) + int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf) : base(env, TrainerUtils.MakeBoolScalarLabel(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves) { Host.CheckNonEmpty(labelColumn, nameof(labelColumn)); @@ -231,7 +230,7 @@ private sealed class ObjectiveFunctionImpl : RandomForestObjectiveFunction private readonly bool[] _labels; public ObjectiveFunctionImpl(Dataset trainSet, bool[] trainSetLabels, Options options) - : base(trainSet, options, options.MaxTreeOutput) + : base(trainSet, options, options.MaximumOutputMagnitudePerTree) { _labels = trainSetLabels; } diff --git a/src/Microsoft.ML.FastTree/RandomForestRegression.cs b/src/Microsoft.ML.FastTree/RandomForestRegression.cs index 609dbad46f..bf999f1134 100644 --- a/src/Microsoft.ML.FastTree/RandomForestRegression.cs +++ b/src/Microsoft.ML.FastTree/RandomForestRegression.cs @@ -8,7 +8,6 @@ using Microsoft.ML.CommandLine; using Microsoft.ML.Data; using Microsoft.ML.EntryPoints; -using Microsoft.ML.Internal.Internallearn; using Microsoft.ML.Internal.Utilities; using Microsoft.ML.Model; using Microsoft.ML.Trainers.FastTree; @@ -276,7 +275,7 @@ internal FastForestRegression(IHostEnvironment env, string weightColumn = null, int numLeaves = Defaults.NumberOfLeaves, int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves) + int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf) : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves) { Host.CheckNonEmpty(labelColumn, nameof(labelColumn)); @@ -310,7 +309,7 @@ private protected override FastForestRegressionModelParameters TrainModelCore(Tr ConvertData(trainData); TrainCore(ch); } - return new FastForestRegressionModelParameters(Host, TrainedEnsemble, FeatureCount, InnerOptions, FastTreeTrainerOptions.QuantileSampleCount); + return new FastForestRegressionModelParameters(Host, TrainedEnsemble, FeatureCount, InnerOptions, FastTreeTrainerOptions.NumberOfQuantileSamples); } private protected override void PrepareLabels(IChannel ch) diff --git a/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs b/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs index b9ae9dd0c6..e32caeb9c7 100644 --- a/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs +++ b/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using Microsoft.ML.Data; using Microsoft.ML.Trainers.FastTree; @@ -20,22 +19,22 @@ public static class TreeExtensions /// The name of the label column. /// The name of the feature column. /// The name of the example weight column (optional). - /// Total number of decision trees to create in the ensemble. - /// The maximum number of leaves per decision tree. - /// The minimal number of datapoints allowed in a leaf of a regression tree, out of the subsampled data. + /// Total number of decision trees to create in the ensemble. + /// The maximum number of leaves per decision tree. + /// The minimal number of datapoints allowed in a leaf of a regression tree, out of the subsampled data. /// The learning rate. public static FastTreeRegressionTrainer FastTree(this RegressionCatalog.RegressionTrainers catalog, string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, - int numLeaves = Defaults.NumberOfLeaves, - int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + int numberOfLeaves = Defaults.NumberOfLeaves, + int numberOfTrees = Defaults.NumberOfTrees, + int minimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); - return new FastTreeRegressionTrainer(env, labelColumnName, featureColumnName, exampleWeightColumnName, numLeaves, numTrees, minDatapointsInLeaves, learningRate); + return new FastTreeRegressionTrainer(env, labelColumnName, featureColumnName, exampleWeightColumnName, numberOfLeaves, numberOfTrees, minimumExampleCountPerLeaf, learningRate); } /// @@ -60,22 +59,22 @@ public static FastTreeRegressionTrainer FastTree(this RegressionCatalog.Regressi /// The name of the label column. /// The name of the feature column. /// The name of the example weight column (optional). - /// Total number of decision trees to create in the ensemble. - /// The maximum number of leaves per decision tree. - /// The minimal number of datapoints allowed in a leaf of the tree, out of the subsampled data. + /// Total number of decision trees to create in the ensemble. + /// The maximum number of leaves per decision tree. + /// The minimal number of datapoints allowed in a leaf of the tree, out of the subsampled data. /// The learning rate. public static FastTreeBinaryClassificationTrainer FastTree(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, - int numLeaves = Defaults.NumberOfLeaves, - int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + int numberOfLeaves = Defaults.NumberOfLeaves, + int numberOfTrees = Defaults.NumberOfTrees, + int minimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); - return new FastTreeBinaryClassificationTrainer(env, labelColumnName, featureColumnName, exampleWeightColumnName, numLeaves, numTrees, minDatapointsInLeaves, learningRate); + return new FastTreeBinaryClassificationTrainer(env, labelColumnName, featureColumnName, exampleWeightColumnName, numberOfLeaves, numberOfTrees, minimumExampleCountPerLeaf, learningRate); } /// @@ -101,23 +100,23 @@ public static FastTreeBinaryClassificationTrainer FastTree(this BinaryClassifica /// The name of the feature column. /// The name of the group column. /// The name of the example weight column (optional). - /// Total number of decision trees to create in the ensemble. - /// The maximum number of leaves per decision tree. - /// The minimal number of datapoints allowed in a leaf of the tree, out of the subsampled data. + /// Total number of decision trees to create in the ensemble. + /// The maximum number of leaves per decision tree. + /// The minimal number of datapoints allowed in a leaf of the tree, out of the subsampled data. /// The learning rate. public static FastTreeRankingTrainer FastTree(this RankingCatalog.RankingTrainers catalog, string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string rowGroupColumnName = DefaultColumnNames.GroupId, string exampleWeightColumnName = null, - int numLeaves = Defaults.NumberOfLeaves, - int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + int numberOfLeaves = Defaults.NumberOfLeaves, + int numberOfTrees = Defaults.NumberOfTrees, + int minimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); - return new FastTreeRankingTrainer(env, labelColumnName, featureColumnName, rowGroupColumnName, exampleWeightColumnName, numLeaves, numTrees, minDatapointsInLeaves, learningRate); + return new FastTreeRankingTrainer(env, labelColumnName, featureColumnName, rowGroupColumnName, exampleWeightColumnName, numberOfLeaves, numberOfTrees, minimumExampleCountPerLeaf, learningRate); } /// @@ -142,20 +141,20 @@ public static FastTreeRankingTrainer FastTree(this RankingCatalog.RankingTrainer /// The name of the label column. /// The name of the feature column. /// The name of the example weight column (optional). - /// The number of iterations to use in learning the features. + /// The number of iterations to use in learning the features. + /// The maximum number of bins to use to approximate features. /// The learning rate. GAMs work best with a small learning rate. - /// The maximum number of bins to use to approximate features. public static BinaryClassificationGamTrainer GeneralizedAdditiveModels(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, - int numIterations = GamDefaults.NumIterations, - double learningRate = GamDefaults.LearningRates, - int maxBins = GamDefaults.MaxBins) + int numberOfIterations = GamDefaults.NumberOfIterations, + int maximumBinCountPerFeature = GamDefaults.MaximumBinCountPerFeature, + double learningRate = GamDefaults.LearningRate) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); - return new BinaryClassificationGamTrainer(env, labelColumnName, featureColumnName, exampleWeightColumnName, numIterations, learningRate, maxBins); + return new BinaryClassificationGamTrainer(env, labelColumnName, featureColumnName, exampleWeightColumnName, numberOfIterations, learningRate, maximumBinCountPerFeature); } /// @@ -178,20 +177,20 @@ public static BinaryClassificationGamTrainer GeneralizedAdditiveModels(this Bina /// The name of the label column. /// The name of the feature column. /// The name of the example weight column (optional). - /// The number of iterations to use in learning the features. + /// The number of iterations to use in learning the features. + /// The maximum number of bins to use to approximate features. /// The learning rate. GAMs work best with a small learning rate. - /// The maximum number of bins to use to approximate features. public static RegressionGamTrainer GeneralizedAdditiveModels(this RegressionCatalog.RegressionTrainers catalog, string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, - int numIterations = GamDefaults.NumIterations, - double learningRate = GamDefaults.LearningRates, - int maxBins = GamDefaults.MaxBins) + int numberOfIterations = GamDefaults.NumberOfIterations, + int maxBinCountPerFeature = GamDefaults.MaximumBinCountPerFeature, + double learningRate = GamDefaults.LearningRate) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); - return new RegressionGamTrainer(env, labelColumnName, featureColumnName, exampleWeightColumnName, numIterations, learningRate, maxBins); + return new RegressionGamTrainer(env, labelColumnName, featureColumnName, exampleWeightColumnName, numberOfIterations, learningRate, maxBinCountPerFeature); } /// @@ -224,7 +223,7 @@ public static FastTreeTweedieTrainer FastTreeTweedie(this RegressionCatalog.Regr string exampleWeightColumnName = null, int numLeaves = Defaults.NumberOfLeaves, int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate) { Contracts.CheckValue(catalog, nameof(catalog)); @@ -263,7 +262,7 @@ public static FastForestRegression FastForest(this RegressionCatalog.RegressionT string exampleWeightColumnName = null, int numLeaves = Defaults.NumberOfLeaves, int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves) + int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); @@ -301,7 +300,7 @@ public static FastForestClassification FastForest(this BinaryClassificationCatal string exampleWeightColumnName = null, int numLeaves = Defaults.NumberOfLeaves, int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves) + int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); diff --git a/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs b/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs index 24f643a259..bbd639dc2b 100644 --- a/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs +++ b/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs @@ -41,7 +41,7 @@ public static Scalar FastTree(this RegressionCatalog.RegressionTrainers c Scalar label, Vector features, Scalar weights = null, int numLeaves = Defaults.NumberOfLeaves, int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate, Action onFit = null) { @@ -134,7 +134,7 @@ public static (Scalar score, Scalar probability, Scalar pred Scalar label, Vector features, Scalar weights = null, int numLeaves = Defaults.NumberOfLeaves, int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate, Action> onFit = null) { @@ -226,7 +226,7 @@ public static Scalar FastTree(this RankingCatalog.RankingTrainers c Scalar label, Vector features, Key groupId, Scalar weights = null, int numLeaves = Defaults.NumberOfLeaves, int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinExampleCountInLeaves, + int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate, Action onFit = null) { diff --git a/test/Microsoft.ML.Functional.Tests/Explainability.cs b/test/Microsoft.ML.Functional.Tests/Explainability.cs index 1dc426a436..d1c678da02 100644 --- a/test/Microsoft.ML.Functional.Tests/Explainability.cs +++ b/test/Microsoft.ML.Functional.Tests/Explainability.cs @@ -258,7 +258,7 @@ public void LocalFeatureImportanceForGamModel() // Create a pipeline to train on the housing data. var pipeline = mlContext.Transforms.Concatenate("Features", HousingRegression.Features) - .Append(mlContext.Regression.Trainers.GeneralizedAdditiveModels(numIterations: 2)); + .Append(mlContext.Regression.Trainers.GeneralizedAdditiveModels(numberOfIterations: 2)); // Fit the pipeline and transform the data. var model = pipeline.Fit(data); diff --git a/test/Microsoft.ML.Predictor.Tests/TestGamPublicInterfaces.cs b/test/Microsoft.ML.Predictor.Tests/TestGamPublicInterfaces.cs index d1fdf4d8aa..1a6a5cf90b 100644 --- a/test/Microsoft.ML.Predictor.Tests/TestGamPublicInterfaces.cs +++ b/test/Microsoft.ML.Predictor.Tests/TestGamPublicInterfaces.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Linq; using Microsoft.ML.Internal.Utilities; using Microsoft.ML.Trainers.FastTree; using Xunit; @@ -33,20 +34,20 @@ public void TestGamDirectInstatiation() var gam = new RegressionGamModelParameters(mlContext, binUpperBounds, binEffects, intercept); // Check that the model has the right number of shape functions - Assert.Equal(binUpperBounds.Length, gam.NumShapeFunctions); + Assert.Equal(binUpperBounds.Length, gam.NumberOfShapeFunctions); // Check the intercept - Assert.Equal(intercept, gam.Intercept, 6); + Assert.Equal(intercept, gam.Bias, 6); // Check that the binUpperBounds were made correctly CheckArrayOfArrayEquality(binUpperBounds, gam.GetBinUpperBounds()); - for (int i = 0; i < gam.NumShapeFunctions; i++) - Utils.AreEqual(binUpperBounds[i], gam.GetBinUpperBounds(i)); + for (int i = 0; i < gam.NumberOfShapeFunctions; i++) + Utils.AreEqual(binUpperBounds[i], gam.GetBinUpperBounds(i).ToArray()); // Check that the bin effects were made correctly CheckArrayOfArrayEquality(binEffects, gam.GetBinEffects()); - for (int i = 0; i < gam.NumShapeFunctions; i++) - Utils.AreEqual(binEffects[i], gam.GetBinEffects(i)); + for (int i = 0; i < gam.NumberOfShapeFunctions; i++) + Utils.AreEqual(binEffects[i], gam.GetBinEffects(i).ToArray()); // Check that the constructor handles null inputs properly Assert.Throws(() => new RegressionGamModelParameters(mlContext, binUpperBounds, null, intercept)); diff --git a/test/Microsoft.ML.Tests/OnnxConversionTest.cs b/test/Microsoft.ML.Tests/OnnxConversionTest.cs index 7bc26635ad..5225391498 100644 --- a/test/Microsoft.ML.Tests/OnnxConversionTest.cs +++ b/test/Microsoft.ML.Tests/OnnxConversionTest.cs @@ -213,7 +213,7 @@ public void KeyToVectorWithBagOnnxConversionTest() var pipeline = mlContext.Transforms.Categorical.OneHotEncoding("F2", "F2", Transforms.OneHotEncodingTransformer.OutputKind.Bag) .Append(mlContext.Transforms.ReplaceMissingValues(new MissingValueReplacingEstimator.ColumnOptions("F2"))) .Append(mlContext.Transforms.Concatenate("Features", "F1", "F2")) - .Append(mlContext.BinaryClassification.Trainers.FastTree(labelColumnName: "Label", featureColumnName: "Features", numLeaves: 2, numTrees: 1, minDatapointsInLeaves: 2)); + .Append(mlContext.BinaryClassification.Trainers.FastTree(labelColumnName: "Label", featureColumnName: "Features", numberOfLeaves: 2, numberOfTrees: 1, minimumExampleCountPerLeaf: 2)); var model = pipeline.Fit(data); var onnxModel = mlContext.Model.ConvertToOnnxProtobuf(model, data); @@ -408,7 +408,7 @@ public void RemoveVariablesInPipelineTest() .Append(mlContext.Transforms.ReplaceMissingValues(new MissingValueReplacingEstimator.ColumnOptions("F2"))) .Append(mlContext.Transforms.Concatenate("Features", "F1", "F2")) .Append(mlContext.Transforms.Normalize("Features")) - .Append(mlContext.BinaryClassification.Trainers.FastTree(labelColumnName: "Label", featureColumnName: "Features", numLeaves: 2, numTrees: 1, minDatapointsInLeaves: 2)); + .Append(mlContext.BinaryClassification.Trainers.FastTree(labelColumnName: "Label", featureColumnName: "Features", numberOfLeaves: 2, numberOfTrees: 1, minimumExampleCountPerLeaf: 2)); var model = pipeline.Fit(data); var transformedData = model.Transform(data); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/CookbookSamples/CookbookSamples.cs b/test/Microsoft.ML.Tests/Scenarios/Api/CookbookSamples/CookbookSamples.cs index f9e4d05d8a..24f311533a 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/CookbookSamples/CookbookSamples.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/CookbookSamples/CookbookSamples.cs @@ -405,7 +405,7 @@ public void TrainOnAutoGeneratedData() var dynamicpipeline = mlContext.Transforms.Categorical.OneHotEncoding("DemographicCategory") .Append(new ColumnConcatenatingEstimator (mlContext, "Features", "DemographicCategory", "LastVisits")) .AppendCacheCheckpoint(mlContext) // FastTree will benefit from caching data in memory. - .Append(mlContext.BinaryClassification.Trainers.FastTree("HasChurned", "Features", numTrees: 20)); + .Append(mlContext.BinaryClassification.Trainers.FastTree("HasChurned", "Features", numberOfTrees: 20)); var dynamicModel = dynamicpipeline.Fit(trainData); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/CookbookSamples/CookbookSamplesDynamicApi.cs b/test/Microsoft.ML.Tests/Scenarios/Api/CookbookSamples/CookbookSamplesDynamicApi.cs index 1cb5b31033..2983250834 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/CookbookSamples/CookbookSamplesDynamicApi.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/CookbookSamples/CookbookSamplesDynamicApi.cs @@ -388,7 +388,7 @@ private void CategoricalFeaturizationOn(params string[] dataPath) // reading them from disk multiple times. .AppendCacheCheckpoint(mlContext) // Now we're ready to train. We chose our FastTree trainer for this classification task. - .Append(mlContext.BinaryClassification.Trainers.FastTree(numTrees: 50)); + .Append(mlContext.BinaryClassification.Trainers.FastTree(numberOfTrees: 50)); // Train the model. var model = fullLearningPipeline.Fit(data); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs index e82545cd34..0cf18bb2f4 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs @@ -51,7 +51,7 @@ public void FastTreeClassificationIntrospectiveTraining() var ml = new MLContext(seed: 1, conc: 1); var data = ml.Data.LoadFromTextFile(GetDataPath(TestDatasets.Sentiment.trainFilename), hasHeader: true, allowQuoting: true); - var trainer = ml.BinaryClassification.Trainers.FastTree(numLeaves: 5, numTrees: 3); + var trainer = ml.BinaryClassification.Trainers.FastTree(numberOfLeaves: 5, numberOfTrees: 3); BinaryPredictionTransformer> pred = null; diff --git a/test/Microsoft.ML.Tests/TrainerEstimators/TreeEstimators.cs b/test/Microsoft.ML.Tests/TrainerEstimators/TreeEstimators.cs index e99dafe865..b714bc6458 100644 --- a/test/Microsoft.ML.Tests/TrainerEstimators/TreeEstimators.cs +++ b/test/Microsoft.ML.Tests/TrainerEstimators/TreeEstimators.cs @@ -72,7 +72,7 @@ public void GAMClassificationEstimator() var trainer = new BinaryClassificationGamTrainer(Env, new BinaryClassificationGamTrainer.Options { GainConfidenceLevel = 0, - NumIterations = 15, + NumberOfIterations = 15, }); var pipeWithTrainer = pipe.Append(trainer); TestEstimatorCore(pipeWithTrainer, dataView); @@ -190,7 +190,7 @@ public void GAMRegressorEstimator() var trainer = new RegressionGamTrainer(Env, new RegressionGamTrainer.Options { EnablePruning = false, - NumIterations = 15, + NumberOfIterations = 15, }); TestEstimatorCore(trainer, dataView); From b90dcd381309cd0da5cab76cae44bccd4062ef5b Mon Sep 17 00:00:00 2001 From: Wei-Sheng Chin Date: Thu, 28 Feb 2019 15:18:25 -0800 Subject: [PATCH 03/12] Address comments --- src/Microsoft.ML.FastTree/BoostingFastTree.cs | 12 ++--- src/Microsoft.ML.FastTree/FastTree.cs | 14 +++--- .../FastTreeArguments.cs | 46 +++++++++---------- .../FastTreeClassification.cs | 2 +- src/Microsoft.ML.FastTree/FastTreeRanking.cs | 6 +-- .../FastTreeRegression.cs | 2 +- src/Microsoft.ML.FastTree/FastTreeTweedie.cs | 2 +- src/Microsoft.ML.FastTree/RandomForest.cs | 12 ++--- .../Algorithms/SmacSweeper.cs | 2 +- .../TreeRepresentation.cs | 2 +- 10 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/Microsoft.ML.FastTree/BoostingFastTree.cs b/src/Microsoft.ML.FastTree/BoostingFastTree.cs index 1512e9643a..62cf422dee 100644 --- a/src/Microsoft.ML.FastTree/BoostingFastTree.cs +++ b/src/Microsoft.ML.FastTree/BoostingFastTree.cs @@ -61,12 +61,12 @@ private protected override void CheckOptions(IChannel ch) private protected override TreeLearner ConstructTreeLearner(IChannel ch) { return new LeastSquaresRegressionTreeLearner( - TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.MinExampleCountPerLeaf, FastTreeTrainerOptions.EntropyCoefficient, + TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.MinimumExampleCountPerLeaf, FastTreeTrainerOptions.EntropyCoefficient, FastTreeTrainerOptions.FeatureFirstUsePenalty, FastTreeTrainerOptions.FeatureReusePenalty, FastTreeTrainerOptions.SoftmaxTemperature, - FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.RandomSeed, FastTreeTrainerOptions.FeatureFractionPerSplit, FastTreeTrainerOptions.FilterZeroLambdas, - FastTreeTrainerOptions.AllowEmptyTrees, FastTreeTrainerOptions.GainConfidenceLevel, FastTreeTrainerOptions.MaxCategoricalGroupsPerNode, - FastTreeTrainerOptions.MaxCategoricalSplitPoints, BsrMaxTreeOutput(), ParallelTraining, - FastTreeTrainerOptions.MinExamplePercentageForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinExamplesForCategoricalSplit, FastTreeTrainerOptions.Bias); + FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.Seed, FastTreeTrainerOptions.FeatureFractionPerSplit, FastTreeTrainerOptions.FilterZeroLambdas, + FastTreeTrainerOptions.AllowEmptyTrees, FastTreeTrainerOptions.GainConfidenceLevel, FastTreeTrainerOptions.MaximumCategoricalGroupsPerNode, + FastTreeTrainerOptions.MaximumCategoricalSplitPoints, BsrMaxTreeOutput(), ParallelTraining, + FastTreeTrainerOptions.MinimumExampleFractionForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinimumExamplesForCategoricalSplit, FastTreeTrainerOptions.Bias); } private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm(IChannel ch) @@ -94,7 +94,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm( optimizationAlgorithm.ObjectiveFunction = ConstructObjFunc(ch); optimizationAlgorithm.Smoothing = FastTreeTrainerOptions.Smoothing; optimizationAlgorithm.DropoutRate = FastTreeTrainerOptions.DropoutRate; - optimizationAlgorithm.DropoutRng = new Random(FastTreeTrainerOptions.RandomSeed); + optimizationAlgorithm.DropoutRng = new Random(FastTreeTrainerOptions.Seed); optimizationAlgorithm.PreScoreUpdateEvent += PrintTestGraph; return optimizationAlgorithm; diff --git a/src/Microsoft.ML.FastTree/FastTree.cs b/src/Microsoft.ML.FastTree/FastTree.cs index 83f20f55b8..37bbc33304 100644 --- a/src/Microsoft.ML.FastTree/FastTree.cs +++ b/src/Microsoft.ML.FastTree/FastTree.cs @@ -115,7 +115,7 @@ private protected FastTreeTrainerBase(IHostEnvironment env, // override with the directly provided values. FastTreeTrainerOptions.NumberOfLeaves = numLeaves; FastTreeTrainerOptions.NumberOfTrees = numTrees; - FastTreeTrainerOptions.MinExampleCountPerLeaf = minDatapointsInLeaves; + FastTreeTrainerOptions.MinimumExampleCountPerLeaf = minDatapointsInLeaves; FastTreeTrainerOptions.LabelColumnName = label.Name; FastTreeTrainerOptions.FeatureColumnName = featureColumn; @@ -198,7 +198,7 @@ private protected void ConvertData(RoleMappedData trainData) { AnnotationUtils.TryGetCategoricalFeatureIndices(trainData.Schema.Schema, trainData.Schema.Feature.Value.Index, out CategoricalFeatures); var useTranspose = UseTranspose(FastTreeTrainerOptions.DiskTranspose, trainData) && (ValidData == null || UseTranspose(FastTreeTrainerOptions.DiskTranspose, ValidData)); - var instanceConverter = new ExamplesToFastTreeBins(Host, FastTreeTrainerOptions.MaxBinCountPerFeature, useTranspose, !FastTreeTrainerOptions.FeatureFlocks, FastTreeTrainerOptions.MinExampleCountPerLeaf, GetMaxLabel()); + var instanceConverter = new ExamplesToFastTreeBins(Host, FastTreeTrainerOptions.MaximumBinCountPerFeature, useTranspose, !FastTreeTrainerOptions.FeatureFlocks, FastTreeTrainerOptions.MinimumExampleCountPerLeaf, GetMaxLabel()); TrainSet = instanceConverter.FindBinsAndReturnDataset(trainData, PredictionKind, ParallelTraining, CategoricalFeatures, FastTreeTrainerOptions.CategoricalSplit); FeatureMap = instanceConverter.FeatureMap; @@ -236,7 +236,7 @@ private protected void TrainCore(IChannel ch) } using (Timer.Time(TimerEvent.TotalTrain)) Train(ch); - if (FastTreeTrainerOptions.ExecutionTimes) + if (FastTreeTrainerOptions.ExecutionTime) PrintExecutionTimes(ch); TrainedEnsemble = Ensemble; if (FeatureMap != null) @@ -423,7 +423,7 @@ private protected bool[] GetActiveFeatures() if (FastTreeTrainerOptions.FeatureFraction < 1.0) { if (_featureSelectionRandom == null) - _featureSelectionRandom = new Random(FastTreeTrainerOptions.FeatureSelectionRandomSeed); + _featureSelectionRandom = new Random(FastTreeTrainerOptions.FeatureSelectionSeed); for (int i = 0; i < TrainSet.NumFeatures; ++i) { @@ -593,7 +593,7 @@ private void GenerateActiveFeatureLists(int numberOfItems) private protected virtual BaggingProvider CreateBaggingProvider() { Contracts.Assert(FastTreeTrainerOptions.BaggingSize > 0); - return new BaggingProvider(TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.RandomSeed, FastTreeTrainerOptions.BaggingExampleFraction); + return new BaggingProvider(TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.Seed, FastTreeTrainerOptions.BaggingExampleFraction); } private protected virtual bool ShouldRandomStartOptimizer() @@ -624,7 +624,7 @@ private protected virtual void Train(IChannel ch) if (Ensemble.NumTrees < numTotalTrees && ShouldRandomStartOptimizer()) { ch.Info("Randomizing start point"); - OptimizationAlgorithm.TrainingScores.RandomizeScores(FastTreeTrainerOptions.RandomSeed, false); + OptimizationAlgorithm.TrainingScores.RandomizeScores(FastTreeTrainerOptions.Seed, false); revertRandomStart = true; } @@ -711,7 +711,7 @@ private protected virtual void Train(IChannel ch) { revertRandomStart = false; ch.Info("Reverting random score assignment"); - OptimizationAlgorithm.TrainingScores.RandomizeScores(FastTreeTrainerOptions.RandomSeed, true); + OptimizationAlgorithm.TrainingScores.RandomizeScores(FastTreeTrainerOptions.Seed, true); } #if !NO_STORE diff --git a/src/Microsoft.ML.FastTree/FastTreeArguments.cs b/src/Microsoft.ML.FastTree/FastTreeArguments.cs index ad0ffd0d82..41c4f2880c 100644 --- a/src/Microsoft.ML.FastTree/FastTreeArguments.cs +++ b/src/Microsoft.ML.FastTree/FastTreeArguments.cs @@ -175,7 +175,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// The seed of the random number generator. /// [Argument(ArgumentType.LastOccurenceWins, HelpText = "The seed of the random number generator", ShortName = "r1,RngSeed")] - public int RandomSeed = 123; + public int Seed = 123; // this random seed is only for active feature selection /// @@ -183,7 +183,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// [Argument(ArgumentType.LastOccurenceWins, HelpText = "The seed of the active feature selection", ShortName = "r3,FeatureSelectSeed", Hide = true)] [TGUI(NotGui = true)] - public int FeatureSelectionRandomSeed = 123; + public int FeatureSelectionSeed = 123; /// /// The entropy (regularization) coefficient between 0 and 1. @@ -221,26 +221,26 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum categorical split groups to consider when splitting on a categorical feature. " + "Split groups are a collection of split points. This is used to reduce overfitting when " + - "there many categorical features.", ShortName = "mcg")] - public int MaxCategoricalGroupsPerNode = 64; + "there many categorical features.", ShortName = "mcg,MaxCategoricalGroupsPerNode")] + public int MaximumCategoricalGroupsPerNode = 64; /// /// Maximum categorical split points to consider when splitting on a categorical feature. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum categorical split points to consider when splitting on a categorical feature.", ShortName = "maxcat")] - public int MaxCategoricalSplitPoints = 64; + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum categorical split points to consider when splitting on a categorical feature.", ShortName = "maxcat,MaxCategoricalSplitPoints")] + public int MaximumCategoricalSplitPoints = 64; /// - /// Minimum categorical example percentage in a bin to consider for a split. + /// Minimum categorical example percentage in a bin to consider for a split. Default is 0.1% of all training examples. /// [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum categorical docs percentage in a bin to consider for a split.", ShortName = "mdop,MinDocsPercentageForCategoricalSplit")] - public double MinExamplePercentageForCategoricalSplit = 0.001; + public double MinimumExampleFractionForCategoricalSplit = 0.001; /// /// Minimum categorical example count in a bin to consider for a split. /// [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum categorical doc count in a bin to consider for a split.", ShortName = "mdo,MinDocsForCategoricalSplit")] - public int MinExamplesForCategoricalSplit = 100; + public int MinimumExamplesForCategoricalSplit = 100; /// /// Bias for calculating gradient for each feature bin for a categorical feature. @@ -263,7 +263,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// Maximum number of distinct values (bins) per feature. /// [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum number of distinct values (bins) per feature", ShortName = "mb,MaxBins")] - public int MaxBinCountPerFeature = 255; // save one for undefs + public int MaximumBinCountPerFeature = 255; // save one for undefs /// /// Sparsity level needed to use sparse feature representation. @@ -300,8 +300,8 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// /// Print execution time breakdown to stdout. /// - [Argument(ArgumentType.AtMostOnce, HelpText = "Print execution time breakdown to stdout", ShortName = "et")] - public bool ExecutionTimes; + [Argument(ArgumentType.AtMostOnce, HelpText = "Print execution time breakdown to stdout", ShortName = "et,ExecutionTimes")] + public bool ExecutionTime; // REVIEW: Different from original FastRank arguments (shortname l vs. nl). Different default from TLC FR Wrapper (20 vs. 20). /// @@ -320,7 +320,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId [Argument(ArgumentType.LastOccurenceWins, HelpText = "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", ShortName = "mil,MinDocumentsInLeafs", SortOrder = 3)] [TGUI(Description = "Minimum number of training instances required to form a leaf", SuggestedSweeps = "1,10,50")] [TlcModule.SweepableDiscreteParamAttribute("MinDocumentsInLeafs", new object[] { 1, 10, 50 })] - public int MinExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf; + public int MinimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf; /// /// Total number of decision trees to create in the ensemble. @@ -332,7 +332,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId public int NumberOfTrees = Defaults.NumberOfTrees; /// - /// The fraction of features (chosen randomly) to use on each iteration. + /// The fraction of features (chosen randomly) to use on each iteration. Use 0.9 if only 90% of features is needed. /// [Argument(ArgumentType.AtMostOnce, HelpText = "The fraction of features (chosen randomly) to use on each iteration", ShortName = "ff")] public Double FeatureFraction = 1; @@ -344,7 +344,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId public int BaggingSize; /// - /// Percentage of training examples used in each bag. + /// Percentage of training examples used in each bag. Default is 0.7 (70%). /// [Argument(ArgumentType.AtMostOnce, HelpText = "Percentage of training examples used in each bag", ShortName = "bagfrac,BaggingTrainFraction")] // REVIEW: sweeping bagfrac doesn't make sense unless 'baggingSize' is non-zero. The 'SuggestedSweeps' here @@ -354,13 +354,13 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId public Double BaggingExampleFraction = 0.7; /// - /// The fraction of features (chosen randomly) to use on each split. + /// The fraction of features (chosen randomly) to use on each split. If it's value is 0.9, 90% of all features would be dropped in expectation. /// [Argument(ArgumentType.AtMostOnce, HelpText = "The fraction of features (chosen randomly) to use on each split", ShortName = "sf,SplitFraction")] public Double FeatureFractionPerSplit = 1; /// - /// Smoothing paramter for tree regularization. + /// Smoothing parameter for tree regularization. /// [Argument(ArgumentType.AtMostOnce, HelpText = "Smoothing paramter for tree regularization", ShortName = "s")] public Double Smoothing; @@ -392,7 +392,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId // REVIEW: Not used. [Argument(ArgumentType.AtMostOnce, HelpText = "Maximum Number of trees after compression", ShortName = "cmpmax,MaxTreesAfterCompression", Hide = true)] [TGUI(NotGui = true)] - public int MaxTreeCountAfterCompression = -1; + public int MaximumTreeCountAfterCompression = -1; /// /// Print metrics graph for the first test set. @@ -425,7 +425,7 @@ internal virtual void Check(IExceptionContext ectx) ectx.CheckUserArg(0 <= FeatureFraction && FeatureFraction <= 1, nameof(FeatureFraction), "Must be between 0 and 1."); ectx.CheckUserArg(0 <= FeatureFractionPerSplit && FeatureFractionPerSplit <= 1, nameof(FeatureFractionPerSplit), "Must be between 0 and 1."); ectx.CheckUserArg(0 <= SoftmaxTemperature, nameof(SoftmaxTemperature), "Must be non-negative."); - ectx.CheckUserArg(0 < MaxBinCountPerFeature, nameof(MaxBinCountPerFeature), "Must greater than 0."); + ectx.CheckUserArg(0 < MaximumBinCountPerFeature, nameof(MaximumBinCountPerFeature), "Must greater than 0."); ectx.CheckUserArg(0 <= SparsifyThreshold && SparsifyThreshold <= 1, nameof(SparsifyThreshold), "Must be between 0 and 1."); ectx.CheckUserArg(0 < NumberOfTrees, nameof(NumberOfTrees), "Must be positive."); ectx.CheckUserArg(0 <= Smoothing && Smoothing <= 1, nameof(Smoothing), "Must be between 0 and 1."); @@ -433,10 +433,10 @@ internal virtual void Check(IExceptionContext ectx) ectx.CheckUserArg(0 <= BaggingExampleFraction && BaggingExampleFraction <= 1, nameof(BaggingExampleFraction), "Must be between 0 and 1."); ectx.CheckUserArg(0 <= FeatureFirstUsePenalty, nameof(FeatureFirstUsePenalty), "Must be non-negative."); ectx.CheckUserArg(0 <= FeatureReusePenalty, nameof(FeatureReusePenalty), "Must be non-negative."); - ectx.CheckUserArg(0 <= MaxCategoricalGroupsPerNode, nameof(MaxCategoricalGroupsPerNode), "Must be non-negative."); - ectx.CheckUserArg(0 <= MaxCategoricalSplitPoints, nameof(MaxCategoricalSplitPoints), "Must be non-negative."); - ectx.CheckUserArg(0 <= MinExamplePercentageForCategoricalSplit, nameof(MinExamplePercentageForCategoricalSplit), "Must be non-negative."); - ectx.CheckUserArg(0 <= MinExamplesForCategoricalSplit, nameof(MinExamplesForCategoricalSplit), "Must be non-negative."); + ectx.CheckUserArg(0 <= MaximumCategoricalGroupsPerNode, nameof(MaximumCategoricalGroupsPerNode), "Must be non-negative."); + ectx.CheckUserArg(0 <= MaximumCategoricalSplitPoints, nameof(MaximumCategoricalSplitPoints), "Must be non-negative."); + ectx.CheckUserArg(0 <= MinimumExampleFractionForCategoricalSplit, nameof(MinimumExampleFractionForCategoricalSplit), "Must be non-negative."); + ectx.CheckUserArg(0 <= MinimumExamplesForCategoricalSplit, nameof(MinimumExamplesForCategoricalSplit), "Must be non-negative."); ectx.CheckUserArg(Bundle.None <= Bundling && Bundling <= Bundle.Adjacent, nameof(Bundling), "Must be between 0 and 2."); ectx.CheckUserArg(Bias >= 0, nameof(Bias), "Must be greater than equal to zero."); } diff --git a/src/Microsoft.ML.FastTree/FastTreeClassification.cs b/src/Microsoft.ML.FastTree/FastTreeClassification.cs index d3b50e6135..e22f84141a 100644 --- a/src/Microsoft.ML.FastTree/FastTreeClassification.cs +++ b/src/Microsoft.ML.FastTree/FastTreeClassification.cs @@ -197,7 +197,7 @@ private protected override ObjectiveFunctionBase ConstructObjFunc(IChannel ch) FastTreeTrainerOptions.MaximumTreeOutput, FastTreeTrainerOptions.GetDerivativesSampleRate, FastTreeTrainerOptions.BestStepRankingRegressionTrees, - FastTreeTrainerOptions.RandomSeed, + FastTreeTrainerOptions.Seed, ParallelTraining); } diff --git a/src/Microsoft.ML.FastTree/FastTreeRanking.cs b/src/Microsoft.ML.FastTree/FastTreeRanking.cs index 48700a1715..a0bcff770c 100644 --- a/src/Microsoft.ML.FastTree/FastTreeRanking.cs +++ b/src/Microsoft.ML.FastTree/FastTreeRanking.cs @@ -177,7 +177,7 @@ private protected override void Initialize(IChannel ch) if (FastTreeTrainerOptions.CompressEnsemble) { _ensembleCompressor = new LassoBasedEnsembleCompressor(); - _ensembleCompressor.Initialize(FastTreeTrainerOptions.NumberOfTrees, TrainSet, TrainSet.Ratings, FastTreeTrainerOptions.RandomSeed); + _ensembleCompressor.Initialize(FastTreeTrainerOptions.NumberOfTrees, TrainSet, TrainSet.Ratings, FastTreeTrainerOptions.Seed); } } @@ -200,7 +200,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm( private protected override BaggingProvider CreateBaggingProvider() { Host.Assert(FastTreeTrainerOptions.BaggingSize > 0); - return new RankingBaggingProvider(TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.RandomSeed, FastTreeTrainerOptions.BaggingExampleFraction); + return new RankingBaggingProvider(TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.Seed, FastTreeTrainerOptions.BaggingExampleFraction); } private protected override void PrepareLabels(IChannel ch) @@ -556,7 +556,7 @@ public LambdaRankObjectiveFunction(Dataset trainset, short[] labels, Options opt options.MaximumTreeOutput, options.GetDerivativesSampleRate, options.BestStepRankingRegressionTrees, - options.RandomSeed) + options.Seed) { _labels = labels; diff --git a/src/Microsoft.ML.FastTree/FastTreeRegression.cs b/src/Microsoft.ML.FastTree/FastTreeRegression.cs index 37c1b06622..be868e65b0 100644 --- a/src/Microsoft.ML.FastTree/FastTreeRegression.cs +++ b/src/Microsoft.ML.FastTree/FastTreeRegression.cs @@ -407,7 +407,7 @@ public ObjectiveImpl(Dataset trainData, Options options) options.MaximumTreeOutput, options.GetDerivativesSampleRate, options.BestStepRankingRegressionTrees, - options.RandomSeed) + options.Seed) { if (options.DropoutRate > 0 && LearningRate > 0) // Don't do shrinkage if dropouts are used. Shrinkage = 1.0 / LearningRate; diff --git a/src/Microsoft.ML.FastTree/FastTreeTweedie.cs b/src/Microsoft.ML.FastTree/FastTreeTweedie.cs index d92789583b..6f31295d75 100644 --- a/src/Microsoft.ML.FastTree/FastTreeTweedie.cs +++ b/src/Microsoft.ML.FastTree/FastTreeTweedie.cs @@ -345,7 +345,7 @@ public ObjectiveImpl(Dataset trainData, Options options) options.MaximumTreeOutput, options.GetDerivativesSampleRate, options.BestStepRankingRegressionTrees, - options.RandomSeed) + options.Seed) { if (options.DropoutRate > 0 && LearningRate > 0) // Don't do shrinkage if dropouts are used. Shrinkage = 1.0 / LearningRate; diff --git a/src/Microsoft.ML.FastTree/RandomForest.cs b/src/Microsoft.ML.FastTree/RandomForest.cs index c4d53ff9a7..212fb972a9 100644 --- a/src/Microsoft.ML.FastTree/RandomForest.cs +++ b/src/Microsoft.ML.FastTree/RandomForest.cs @@ -61,12 +61,12 @@ private protected override void InitializeTests() private protected override TreeLearner ConstructTreeLearner(IChannel ch) { return new RandomForestLeastSquaresTreeLearner( - TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.MinExampleCountPerLeaf, FastTreeTrainerOptions.EntropyCoefficient, + TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.MinimumExampleCountPerLeaf, FastTreeTrainerOptions.EntropyCoefficient, FastTreeTrainerOptions.FeatureFirstUsePenalty, FastTreeTrainerOptions.FeatureReusePenalty, FastTreeTrainerOptions.SoftmaxTemperature, - FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.RandomSeed, FastTreeTrainerOptions.FeatureFractionPerSplit, - FastTreeTrainerOptions.AllowEmptyTrees, FastTreeTrainerOptions.GainConfidenceLevel, FastTreeTrainerOptions.MaxCategoricalGroupsPerNode, - FastTreeTrainerOptions.MaxCategoricalSplitPoints, _quantileEnabled, FastTreeTrainerOptions.NumberOfQuantileSamples, ParallelTraining, - FastTreeTrainerOptions.MinExamplePercentageForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinExamplesForCategoricalSplit, FastTreeTrainerOptions.Bias); + FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.Seed, FastTreeTrainerOptions.FeatureFractionPerSplit, + FastTreeTrainerOptions.AllowEmptyTrees, FastTreeTrainerOptions.GainConfidenceLevel, FastTreeTrainerOptions.MaximumCategoricalGroupsPerNode, + FastTreeTrainerOptions.MaximumCategoricalSplitPoints, _quantileEnabled, FastTreeTrainerOptions.NumberOfQuantileSamples, ParallelTraining, + FastTreeTrainerOptions.MinimumExampleFractionForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinimumExamplesForCategoricalSplit, FastTreeTrainerOptions.Bias); } internal abstract class RandomForestObjectiveFunction : ObjectiveFunctionBase @@ -78,7 +78,7 @@ protected RandomForestObjectiveFunction(Dataset trainData, TOptions options, dou maxStepSize, 1, // No derivative sampling in random forests. false, // Improvements to quasi-newton step not relevant to RF. - options.RandomSeed) + options.Seed) { } } diff --git a/src/Microsoft.ML.Sweeper/Algorithms/SmacSweeper.cs b/src/Microsoft.ML.Sweeper/Algorithms/SmacSweeper.cs index 3401c49843..772a8d07ad 100644 --- a/src/Microsoft.ML.Sweeper/Algorithms/SmacSweeper.cs +++ b/src/Microsoft.ML.Sweeper/Algorithms/SmacSweeper.cs @@ -138,7 +138,7 @@ private FastForestRegressionModelParameters FitModel(IEnumerable pre { FeatureFraction = _args.SplitRatio, NumberOfTrees = _args.NumOfTrees, - MinExampleCountPerLeaf = _args.NMinForSplit, + MinimumExampleCountPerLeaf = _args.NMinForSplit, LabelColumnName = DefaultColumnNames.Label, FeatureColumnName = DefaultColumnNames.Features, }); diff --git a/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs b/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs index e5be2e43bc..01592f29cd 100644 --- a/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs +++ b/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs @@ -113,7 +113,7 @@ public void FastTreeRegressionRepresentationWithCategoricalSplit() NumberOfThreads = 1, // This is the minimal samples to form a split (i.e., generating two extra nodes/leaves). For a small data set, // we should set a small value. Otherwise, the trained trees could be empty. - MinExampleCountPerLeaf = 2 + MinimumExampleCountPerLeaf = 2 }; var est = reader.MakeNewEstimator() From ab58a46de80cdd18329d03d3a40a78ad1489a0f7 Mon Sep 17 00:00:00 2001 From: Wei-Sheng Chin Date: Thu, 28 Feb 2019 15:50:14 -0800 Subject: [PATCH 04/12] Address comments and update entry-point catalog --- src/Microsoft.ML.FastTree/FastTree.cs | 4 +- .../FastTreeArguments.cs | 8 +- .../Common/EntryPoints/core_manifest.json | 995 +++++++++++------- 3 files changed, 604 insertions(+), 403 deletions(-) diff --git a/src/Microsoft.ML.FastTree/FastTree.cs b/src/Microsoft.ML.FastTree/FastTree.cs index 37bbc33304..c468315915 100644 --- a/src/Microsoft.ML.FastTree/FastTree.cs +++ b/src/Microsoft.ML.FastTree/FastTree.cs @@ -237,7 +237,7 @@ private protected void TrainCore(IChannel ch) using (Timer.Time(TimerEvent.TotalTrain)) Train(ch); if (FastTreeTrainerOptions.ExecutionTime) - PrintExecutionTimes(ch); + PrintExecutionTime(ch); TrainedEnsemble = Ensemble; if (FeatureMap != null) TrainedEnsemble.RemapFeatures(FeatureMap); @@ -257,7 +257,7 @@ private protected virtual void InitializeThreads(int numThreads) ThreadTaskManager.Initialize(numThreads); } - private protected virtual void PrintExecutionTimes(IChannel ch) + private protected virtual void PrintExecutionTime(IChannel ch) { ch.Info("Execution time breakdown:\n{0}", Timer.GetString()); } diff --git a/src/Microsoft.ML.FastTree/FastTreeArguments.cs b/src/Microsoft.ML.FastTree/FastTreeArguments.cs index 41c4f2880c..9464b36697 100644 --- a/src/Microsoft.ML.FastTree/FastTreeArguments.cs +++ b/src/Microsoft.ML.FastTree/FastTreeArguments.cs @@ -298,7 +298,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId public Double SoftmaxTemperature; /// - /// Print execution time breakdown to stdout. + /// Print execution time breakdown to ML.NET channel. /// [Argument(ArgumentType.AtMostOnce, HelpText = "Print execution time breakdown to stdout", ShortName = "et,ExecutionTimes")] public bool ExecutionTime; @@ -397,17 +397,19 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// /// Print metrics graph for the first test set. /// + [BestFriend] [Argument(ArgumentType.LastOccurenceWins, HelpText = "Print metrics graph for the first test set", ShortName = "graph", Hide = true)] [TGUI(NotGui = true)] - public bool PrintTestGraph; + internal bool PrintTestGraph; /// /// Print Train and Validation metrics in graph. /// //It is only enabled if printTestGraph is also set + [BestFriend] [Argument(ArgumentType.LastOccurenceWins, HelpText = "Print Train and Validation metrics in graph", ShortName = "graphtv", Hide = true)] [TGUI(NotGui = true)] - public bool PrintTrainValidGraph; + internal bool PrintTrainValidGraph; /// /// Calculate metric values for train/valid/test every k rounds. diff --git a/test/BaselineOutput/Common/EntryPoints/core_manifest.json b/test/BaselineOutput/Common/EntryPoints/core_manifest.json index 8368b448e2..6d3479dde2 100644 --- a/test/BaselineOutput/Common/EntryPoints/core_manifest.json +++ b/test/BaselineOutput/Common/EntryPoints/core_manifest.json @@ -5094,11 +5094,12 @@ "ShortName": "ff", "Inputs": [ { - "Name": "NumTrees", + "Name": "NumberOfTrees", "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter" + "iter", + "NumTrees" ], "Required": false, "SortOrder": 1.0, @@ -5125,11 +5126,12 @@ "IsNullable": false }, { - "Name": "NumLeaves", + "Name": "NumberOfLeaves", "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl" + "nl", + "NumLeaves" ], "Required": false, "SortOrder": 2.0, @@ -5156,11 +5158,12 @@ "Default": "Features" }, { - "Name": "MinDocumentsInLeafs", + "Name": "MinimumExampleCountPerLeaf", "Type": "Int", "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil" + "mil", + "MinDocumentsInLeafs" ], "Required": false, "SortOrder": 3.0, @@ -5251,11 +5254,12 @@ "Default": "Auto" }, { - "Name": "MaxTreeOutput", + "Name": "MaximumOutputMagnitudePerTree", "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo" + "mo", + "MaxTreeOutput" ], "Required": false, "SortOrder": 150.0, @@ -5286,11 +5290,12 @@ "Default": 1000000 }, { - "Name": "QuantileSampleCount", + "Name": "NumberOfQuantileSamples", "Type": "Int", "Desc": "Number of labels to be sampled from each leaf to make the distribtuion", "Aliases": [ - "qsc" + "qsc", + "QuantileSampleCount" ], "Required": false, "SortOrder": 150.0, @@ -5315,11 +5320,12 @@ } }, { - "Name": "NumThreads", + "Name": "NumberOfThreads", "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t" + "t", + "NumThreads" ], "Required": false, "SortOrder": 150.0, @@ -5327,11 +5333,12 @@ "Default": null }, { - "Name": "RngSeed", + "Name": "Seed", "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1" + "r1", + "RngSeed" ], "Required": false, "SortOrder": 150.0, @@ -5339,11 +5346,12 @@ "Default": 123 }, { - "Name": "FeatureSelectSeed", + "Name": "FeatureSelectionSeed", "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3" + "r3", + "FeatureSelectSeed" ], "Required": false, "SortOrder": 150.0, @@ -5411,11 +5419,12 @@ "Default": false }, { - "Name": "MaxCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupsPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg" + "mcg", + "MaxCategoricalGroupsPerNode" ], "Required": false, "SortOrder": 150.0, @@ -5423,11 +5432,12 @@ "Default": 64 }, { - "Name": "MaxCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPoints", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat" + "maxcat", + "MaxCategoricalSplitPoints" ], "Required": false, "SortOrder": 150.0, @@ -5435,11 +5445,12 @@ "Default": 64 }, { - "Name": "MinDocsPercentageForCategoricalSplit", + "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", "Aliases": [ - "mdop" + "mdop", + "MinDocsPercentageForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -5447,11 +5458,12 @@ "Default": 0.001 }, { - "Name": "MinDocsForCategoricalSplit", + "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", "Desc": "Minimum categorical doc count in a bin to consider for a split.", "Aliases": [ - "mdo" + "mdo", + "MinDocsForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -5490,11 +5502,12 @@ "Default": "None" }, { - "Name": "MaxBins", + "Name": "MaximumBinCountPerFeature", "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb" + "mb", + "MaxBins" ], "Required": false, "SortOrder": 150.0, @@ -5562,11 +5575,12 @@ "Default": 0.0 }, { - "Name": "ExecutionTimes", + "Name": "ExecutionTime", "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et" + "et", + "ExecutionTimes" ], "Required": false, "SortOrder": 150.0, @@ -5598,11 +5612,12 @@ "Default": 1 }, { - "Name": "BaggingTrainFraction", + "Name": "BaggingExampleFraction", "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac" + "bagfrac", + "BaggingTrainFraction" ], "Required": false, "SortOrder": 150.0, @@ -5610,11 +5625,12 @@ "Default": 0.7 }, { - "Name": "SplitFraction", + "Name": "FeatureFractionPerSplit", "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf" + "sf", + "SplitFraction" ], "Required": false, "SortOrder": 150.0, @@ -5671,11 +5687,12 @@ "Default": false }, { - "Name": "MaxTreesAfterCompression", + "Name": "MaximumTreeCountAfterCompression", "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax" + "cmpmax", + "MaxTreesAfterCompression" ], "Required": false, "SortOrder": 150.0, @@ -5744,11 +5761,12 @@ "ShortName": "ffr", "Inputs": [ { - "Name": "NumTrees", + "Name": "NumberOfTrees", "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter" + "iter", + "NumTrees" ], "Required": false, "SortOrder": 1.0, @@ -5775,11 +5793,12 @@ "IsNullable": false }, { - "Name": "NumLeaves", + "Name": "NumberOfLeaves", "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl" + "nl", + "NumLeaves" ], "Required": false, "SortOrder": 2.0, @@ -5806,11 +5825,12 @@ "Default": "Features" }, { - "Name": "MinDocumentsInLeafs", + "Name": "MinimumExampleCountPerLeaf", "Type": "Int", "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil" + "mil", + "MinDocumentsInLeafs" ], "Required": false, "SortOrder": 3.0, @@ -5910,11 +5930,12 @@ "Default": false }, { - "Name": "QuantileSampleCount", + "Name": "NumberOfQuantileSamples", "Type": "Int", "Desc": "Number of labels to be sampled from each leaf to make the distribtuion", "Aliases": [ - "qsc" + "qsc", + "QuantileSampleCount" ], "Required": false, "SortOrder": 150.0, @@ -5939,11 +5960,12 @@ } }, { - "Name": "NumThreads", + "Name": "NumberOfThreads", "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t" + "t", + "NumThreads" ], "Required": false, "SortOrder": 150.0, @@ -5951,11 +5973,12 @@ "Default": null }, { - "Name": "RngSeed", + "Name": "Seed", "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1" + "r1", + "RngSeed" ], "Required": false, "SortOrder": 150.0, @@ -5963,11 +5986,12 @@ "Default": 123 }, { - "Name": "FeatureSelectSeed", + "Name": "FeatureSelectionSeed", "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3" + "r3", + "FeatureSelectSeed" ], "Required": false, "SortOrder": 150.0, @@ -6035,11 +6059,12 @@ "Default": false }, { - "Name": "MaxCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupsPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg" + "mcg", + "MaxCategoricalGroupsPerNode" ], "Required": false, "SortOrder": 150.0, @@ -6047,11 +6072,12 @@ "Default": 64 }, { - "Name": "MaxCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPoints", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat" + "maxcat", + "MaxCategoricalSplitPoints" ], "Required": false, "SortOrder": 150.0, @@ -6059,11 +6085,12 @@ "Default": 64 }, { - "Name": "MinDocsPercentageForCategoricalSplit", + "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", "Aliases": [ - "mdop" + "mdop", + "MinDocsPercentageForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -6071,11 +6098,12 @@ "Default": 0.001 }, { - "Name": "MinDocsForCategoricalSplit", + "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", "Desc": "Minimum categorical doc count in a bin to consider for a split.", "Aliases": [ - "mdo" + "mdo", + "MinDocsForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -6114,11 +6142,12 @@ "Default": "None" }, { - "Name": "MaxBins", + "Name": "MaximumBinCountPerFeature", "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb" + "mb", + "MaxBins" ], "Required": false, "SortOrder": 150.0, @@ -6186,11 +6215,12 @@ "Default": 0.0 }, { - "Name": "ExecutionTimes", + "Name": "ExecutionTime", "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et" + "et", + "ExecutionTimes" ], "Required": false, "SortOrder": 150.0, @@ -6222,11 +6252,12 @@ "Default": 1 }, { - "Name": "BaggingTrainFraction", + "Name": "BaggingExampleFraction", "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac" + "bagfrac", + "BaggingTrainFraction" ], "Required": false, "SortOrder": 150.0, @@ -6234,11 +6265,12 @@ "Default": 0.7 }, { - "Name": "SplitFraction", + "Name": "FeatureFractionPerSplit", "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf" + "sf", + "SplitFraction" ], "Required": false, "SortOrder": 150.0, @@ -6295,11 +6327,12 @@ "Default": false }, { - "Name": "MaxTreesAfterCompression", + "Name": "MaximumTreeCountAfterCompression", "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax" + "cmpmax", + "MaxTreesAfterCompression" ], "Required": false, "SortOrder": 150.0, @@ -6368,11 +6401,12 @@ "ShortName": "ftc", "Inputs": [ { - "Name": "NumTrees", + "Name": "NumberOfTrees", "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter" + "iter", + "NumTrees" ], "Required": false, "SortOrder": 1.0, @@ -6399,11 +6433,12 @@ "IsNullable": false }, { - "Name": "NumLeaves", + "Name": "NumberOfLeaves", "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl" + "nl", + "NumLeaves" ], "Required": false, "SortOrder": 2.0, @@ -6430,11 +6465,12 @@ "Default": "Features" }, { - "Name": "MinDocumentsInLeafs", + "Name": "MinimumExampleCountPerLeaf", "Type": "Int", "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil" + "mil", + "MinDocumentsInLeafs" ], "Required": false, "SortOrder": 3.0, @@ -6462,11 +6498,12 @@ "Default": "Label" }, { - "Name": "LearningRates", + "Name": "LearningRate", "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr" + "lr", + "LearningRates" ], "Required": false, "SortOrder": 4.0, @@ -6579,11 +6616,12 @@ "Default": false }, { - "Name": "NumPostBracketSteps", + "Name": "MaximumNumberOfLineSearchSteps", "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps" + "lssteps", + "NumPostBracketSteps" ], "Required": false, "SortOrder": 150.0, @@ -6591,11 +6629,12 @@ "Default": 0 }, { - "Name": "MinStepSize", + "Name": "MinimumStepSize", "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep" + "minstep", + "MinStepSize" ], "Required": false, "SortOrder": 150.0, @@ -6761,11 +6800,12 @@ "Default": false }, { - "Name": "MaxTreeOutput", + "Name": "MaximumTreeOutput", "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo" + "mo", + "MaxTreeOutput" ], "Required": false, "SortOrder": 150.0, @@ -6850,11 +6890,12 @@ } }, { - "Name": "NumThreads", + "Name": "NumberOfThreads", "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t" + "t", + "NumThreads" ], "Required": false, "SortOrder": 150.0, @@ -6862,11 +6903,12 @@ "Default": null }, { - "Name": "RngSeed", + "Name": "Seed", "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1" + "r1", + "RngSeed" ], "Required": false, "SortOrder": 150.0, @@ -6874,11 +6916,12 @@ "Default": 123 }, { - "Name": "FeatureSelectSeed", + "Name": "FeatureSelectionSeed", "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3" + "r3", + "FeatureSelectSeed" ], "Required": false, "SortOrder": 150.0, @@ -6946,11 +6989,12 @@ "Default": false }, { - "Name": "MaxCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupsPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg" + "mcg", + "MaxCategoricalGroupsPerNode" ], "Required": false, "SortOrder": 150.0, @@ -6958,11 +7002,12 @@ "Default": 64 }, { - "Name": "MaxCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPoints", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat" + "maxcat", + "MaxCategoricalSplitPoints" ], "Required": false, "SortOrder": 150.0, @@ -6970,11 +7015,12 @@ "Default": 64 }, { - "Name": "MinDocsPercentageForCategoricalSplit", + "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", "Aliases": [ - "mdop" + "mdop", + "MinDocsPercentageForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -6982,11 +7028,12 @@ "Default": 0.001 }, { - "Name": "MinDocsForCategoricalSplit", + "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", "Desc": "Minimum categorical doc count in a bin to consider for a split.", "Aliases": [ - "mdo" + "mdo", + "MinDocsForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -7025,11 +7072,12 @@ "Default": "None" }, { - "Name": "MaxBins", + "Name": "MaximumBinCountPerFeature", "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb" + "mb", + "MaxBins" ], "Required": false, "SortOrder": 150.0, @@ -7097,11 +7145,12 @@ "Default": 0.0 }, { - "Name": "ExecutionTimes", + "Name": "ExecutionTime", "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et" + "et", + "ExecutionTimes" ], "Required": false, "SortOrder": 150.0, @@ -7133,11 +7182,12 @@ "Default": 0 }, { - "Name": "BaggingTrainFraction", + "Name": "BaggingExampleFraction", "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac" + "bagfrac", + "BaggingTrainFraction" ], "Required": false, "SortOrder": 150.0, @@ -7145,11 +7195,12 @@ "Default": 0.7 }, { - "Name": "SplitFraction", + "Name": "FeatureFractionPerSplit", "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf" + "sf", + "SplitFraction" ], "Required": false, "SortOrder": 150.0, @@ -7206,11 +7257,12 @@ "Default": false }, { - "Name": "MaxTreesAfterCompression", + "Name": "MaximumTreeCountAfterCompression", "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax" + "cmpmax", + "MaxTreesAfterCompression" ], "Required": false, "SortOrder": 150.0, @@ -7279,11 +7331,12 @@ "ShortName": "ftrank", "Inputs": [ { - "Name": "NumTrees", + "Name": "NumberOfTrees", "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter" + "iter", + "NumTrees" ], "Required": false, "SortOrder": 1.0, @@ -7310,11 +7363,12 @@ "IsNullable": false }, { - "Name": "NumLeaves", + "Name": "NumberOfLeaves", "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl" + "nl", + "NumLeaves" ], "Required": false, "SortOrder": 2.0, @@ -7341,11 +7395,12 @@ "Default": "Features" }, { - "Name": "MinDocumentsInLeafs", + "Name": "MinimumExampleCountPerLeaf", "Type": "Int", "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil" + "mil", + "MinDocumentsInLeafs" ], "Required": false, "SortOrder": 3.0, @@ -7373,11 +7428,12 @@ "Default": "Label" }, { - "Name": "LearningRates", + "Name": "LearningRate", "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr" + "lr", + "LearningRates" ], "Required": false, "SortOrder": 4.0, @@ -7571,11 +7627,12 @@ "Default": false }, { - "Name": "NumPostBracketSteps", + "Name": "MaximumNumberOfLineSearchSteps", "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps" + "lssteps", + "NumPostBracketSteps" ], "Required": false, "SortOrder": 150.0, @@ -7583,11 +7640,12 @@ "Default": 0 }, { - "Name": "MinStepSize", + "Name": "MinimumStepSize", "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep" + "minstep", + "MinStepSize" ], "Required": false, "SortOrder": 150.0, @@ -7753,11 +7811,12 @@ "Default": false }, { - "Name": "MaxTreeOutput", + "Name": "MaximumTreeOutput", "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo" + "mo", + "MaxTreeOutput" ], "Required": false, "SortOrder": 150.0, @@ -7842,11 +7901,12 @@ } }, { - "Name": "NumThreads", + "Name": "NumberOfThreads", "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t" + "t", + "NumThreads" ], "Required": false, "SortOrder": 150.0, @@ -7854,11 +7914,12 @@ "Default": null }, { - "Name": "RngSeed", + "Name": "Seed", "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1" + "r1", + "RngSeed" ], "Required": false, "SortOrder": 150.0, @@ -7866,11 +7927,12 @@ "Default": 123 }, { - "Name": "FeatureSelectSeed", + "Name": "FeatureSelectionSeed", "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3" + "r3", + "FeatureSelectSeed" ], "Required": false, "SortOrder": 150.0, @@ -7938,11 +8000,12 @@ "Default": false }, { - "Name": "MaxCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupsPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg" + "mcg", + "MaxCategoricalGroupsPerNode" ], "Required": false, "SortOrder": 150.0, @@ -7950,11 +8013,12 @@ "Default": 64 }, { - "Name": "MaxCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPoints", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat" + "maxcat", + "MaxCategoricalSplitPoints" ], "Required": false, "SortOrder": 150.0, @@ -7962,11 +8026,12 @@ "Default": 64 }, { - "Name": "MinDocsPercentageForCategoricalSplit", + "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", "Aliases": [ - "mdop" + "mdop", + "MinDocsPercentageForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -7974,11 +8039,12 @@ "Default": 0.001 }, { - "Name": "MinDocsForCategoricalSplit", + "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", "Desc": "Minimum categorical doc count in a bin to consider for a split.", "Aliases": [ - "mdo" + "mdo", + "MinDocsForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -8017,11 +8083,12 @@ "Default": "None" }, { - "Name": "MaxBins", + "Name": "MaximumBinCountPerFeature", "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb" + "mb", + "MaxBins" ], "Required": false, "SortOrder": 150.0, @@ -8089,11 +8156,12 @@ "Default": 0.0 }, { - "Name": "ExecutionTimes", + "Name": "ExecutionTime", "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et" + "et", + "ExecutionTimes" ], "Required": false, "SortOrder": 150.0, @@ -8125,11 +8193,12 @@ "Default": 0 }, { - "Name": "BaggingTrainFraction", + "Name": "BaggingExampleFraction", "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac" + "bagfrac", + "BaggingTrainFraction" ], "Required": false, "SortOrder": 150.0, @@ -8137,11 +8206,12 @@ "Default": 0.7 }, { - "Name": "SplitFraction", + "Name": "FeatureFractionPerSplit", "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf" + "sf", + "SplitFraction" ], "Required": false, "SortOrder": 150.0, @@ -8198,11 +8268,12 @@ "Default": false }, { - "Name": "MaxTreesAfterCompression", + "Name": "MaximumTreeCountAfterCompression", "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax" + "cmpmax", + "MaxTreesAfterCompression" ], "Required": false, "SortOrder": 150.0, @@ -8271,11 +8342,12 @@ "ShortName": "ftr", "Inputs": [ { - "Name": "NumTrees", + "Name": "NumberOfTrees", "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter" + "iter", + "NumTrees" ], "Required": false, "SortOrder": 1.0, @@ -8302,11 +8374,12 @@ "IsNullable": false }, { - "Name": "NumLeaves", + "Name": "NumberOfLeaves", "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl" + "nl", + "NumLeaves" ], "Required": false, "SortOrder": 2.0, @@ -8333,11 +8406,12 @@ "Default": "Features" }, { - "Name": "MinDocumentsInLeafs", + "Name": "MinimumExampleCountPerLeaf", "Type": "Int", "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil" + "mil", + "MinDocumentsInLeafs" ], "Required": false, "SortOrder": 3.0, @@ -8365,11 +8439,12 @@ "Default": "Label" }, { - "Name": "LearningRates", + "Name": "LearningRate", "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr" + "lr", + "LearningRates" ], "Required": false, "SortOrder": 4.0, @@ -8470,11 +8545,12 @@ "Default": false }, { - "Name": "NumPostBracketSteps", + "Name": "MaximumNumberOfLineSearchSteps", "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps" + "lssteps", + "NumPostBracketSteps" ], "Required": false, "SortOrder": 150.0, @@ -8482,11 +8558,12 @@ "Default": 0 }, { - "Name": "MinStepSize", + "Name": "MinimumStepSize", "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep" + "minstep", + "MinStepSize" ], "Required": false, "SortOrder": 150.0, @@ -8652,11 +8729,12 @@ "Default": false }, { - "Name": "MaxTreeOutput", + "Name": "MaximumTreeOutput", "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo" + "mo", + "MaxTreeOutput" ], "Required": false, "SortOrder": 150.0, @@ -8741,11 +8819,12 @@ } }, { - "Name": "NumThreads", + "Name": "NumberOfThreads", "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t" + "t", + "NumThreads" ], "Required": false, "SortOrder": 150.0, @@ -8753,11 +8832,12 @@ "Default": null }, { - "Name": "RngSeed", + "Name": "Seed", "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1" + "r1", + "RngSeed" ], "Required": false, "SortOrder": 150.0, @@ -8765,11 +8845,12 @@ "Default": 123 }, { - "Name": "FeatureSelectSeed", + "Name": "FeatureSelectionSeed", "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3" + "r3", + "FeatureSelectSeed" ], "Required": false, "SortOrder": 150.0, @@ -8837,11 +8918,12 @@ "Default": false }, { - "Name": "MaxCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupsPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg" + "mcg", + "MaxCategoricalGroupsPerNode" ], "Required": false, "SortOrder": 150.0, @@ -8849,11 +8931,12 @@ "Default": 64 }, { - "Name": "MaxCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPoints", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat" + "maxcat", + "MaxCategoricalSplitPoints" ], "Required": false, "SortOrder": 150.0, @@ -8861,11 +8944,12 @@ "Default": 64 }, { - "Name": "MinDocsPercentageForCategoricalSplit", + "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", "Aliases": [ - "mdop" + "mdop", + "MinDocsPercentageForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -8873,11 +8957,12 @@ "Default": 0.001 }, { - "Name": "MinDocsForCategoricalSplit", + "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", "Desc": "Minimum categorical doc count in a bin to consider for a split.", "Aliases": [ - "mdo" + "mdo", + "MinDocsForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -8916,11 +9001,12 @@ "Default": "None" }, { - "Name": "MaxBins", + "Name": "MaximumBinCountPerFeature", "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb" + "mb", + "MaxBins" ], "Required": false, "SortOrder": 150.0, @@ -8988,11 +9074,12 @@ "Default": 0.0 }, { - "Name": "ExecutionTimes", + "Name": "ExecutionTime", "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et" + "et", + "ExecutionTimes" ], "Required": false, "SortOrder": 150.0, @@ -9024,11 +9111,12 @@ "Default": 0 }, { - "Name": "BaggingTrainFraction", + "Name": "BaggingExampleFraction", "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac" + "bagfrac", + "BaggingTrainFraction" ], "Required": false, "SortOrder": 150.0, @@ -9036,11 +9124,12 @@ "Default": 0.7 }, { - "Name": "SplitFraction", + "Name": "FeatureFractionPerSplit", "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf" + "sf", + "SplitFraction" ], "Required": false, "SortOrder": 150.0, @@ -9097,11 +9186,12 @@ "Default": false }, { - "Name": "MaxTreesAfterCompression", + "Name": "MaximumTreeCountAfterCompression", "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax" + "cmpmax", + "MaxTreesAfterCompression" ], "Required": false, "SortOrder": 150.0, @@ -9170,11 +9260,12 @@ "ShortName": "fttweedie", "Inputs": [ { - "Name": "NumTrees", + "Name": "NumberOfTrees", "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter" + "iter", + "NumTrees" ], "Required": false, "SortOrder": 1.0, @@ -9201,11 +9292,12 @@ "IsNullable": false }, { - "Name": "NumLeaves", + "Name": "NumberOfLeaves", "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl" + "nl", + "NumLeaves" ], "Required": false, "SortOrder": 2.0, @@ -9232,11 +9324,12 @@ "Default": "Features" }, { - "Name": "MinDocumentsInLeafs", + "Name": "MinimumExampleCountPerLeaf", "Type": "Int", "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil" + "mil", + "MinDocumentsInLeafs" ], "Required": false, "SortOrder": 3.0, @@ -9264,11 +9357,12 @@ "Default": "Label" }, { - "Name": "LearningRates", + "Name": "LearningRate", "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr" + "lr", + "LearningRates" ], "Required": false, "SortOrder": 4.0, @@ -9378,11 +9472,12 @@ "Default": false }, { - "Name": "NumPostBracketSteps", + "Name": "MaximumNumberOfLineSearchSteps", "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps" + "lssteps", + "NumPostBracketSteps" ], "Required": false, "SortOrder": 150.0, @@ -9390,11 +9485,12 @@ "Default": 0 }, { - "Name": "MinStepSize", + "Name": "MinimumStepSize", "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep" + "minstep", + "MinStepSize" ], "Required": false, "SortOrder": 150.0, @@ -9560,11 +9656,12 @@ "Default": false }, { - "Name": "MaxTreeOutput", + "Name": "MaximumTreeOutput", "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo" + "mo", + "MaxTreeOutput" ], "Required": false, "SortOrder": 150.0, @@ -9649,11 +9746,12 @@ } }, { - "Name": "NumThreads", + "Name": "NumberOfThreads", "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t" + "t", + "NumThreads" ], "Required": false, "SortOrder": 150.0, @@ -9661,11 +9759,12 @@ "Default": null }, { - "Name": "RngSeed", + "Name": "Seed", "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1" + "r1", + "RngSeed" ], "Required": false, "SortOrder": 150.0, @@ -9673,11 +9772,12 @@ "Default": 123 }, { - "Name": "FeatureSelectSeed", + "Name": "FeatureSelectionSeed", "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3" + "r3", + "FeatureSelectSeed" ], "Required": false, "SortOrder": 150.0, @@ -9745,11 +9845,12 @@ "Default": false }, { - "Name": "MaxCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupsPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg" + "mcg", + "MaxCategoricalGroupsPerNode" ], "Required": false, "SortOrder": 150.0, @@ -9757,11 +9858,12 @@ "Default": 64 }, { - "Name": "MaxCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPoints", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat" + "maxcat", + "MaxCategoricalSplitPoints" ], "Required": false, "SortOrder": 150.0, @@ -9769,11 +9871,12 @@ "Default": 64 }, { - "Name": "MinDocsPercentageForCategoricalSplit", + "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", "Aliases": [ - "mdop" + "mdop", + "MinDocsPercentageForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -9781,11 +9884,12 @@ "Default": 0.001 }, { - "Name": "MinDocsForCategoricalSplit", + "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", "Desc": "Minimum categorical doc count in a bin to consider for a split.", "Aliases": [ - "mdo" + "mdo", + "MinDocsForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -9824,11 +9928,12 @@ "Default": "None" }, { - "Name": "MaxBins", + "Name": "MaximumBinCountPerFeature", "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb" + "mb", + "MaxBins" ], "Required": false, "SortOrder": 150.0, @@ -9896,11 +10001,12 @@ "Default": 0.0 }, { - "Name": "ExecutionTimes", + "Name": "ExecutionTime", "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et" + "et", + "ExecutionTimes" ], "Required": false, "SortOrder": 150.0, @@ -9932,11 +10038,12 @@ "Default": 0 }, { - "Name": "BaggingTrainFraction", + "Name": "BaggingExampleFraction", "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac" + "bagfrac", + "BaggingTrainFraction" ], "Required": false, "SortOrder": 150.0, @@ -9944,11 +10051,12 @@ "Default": 0.7 }, { - "Name": "SplitFraction", + "Name": "FeatureFractionPerSplit", "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf" + "sf", + "SplitFraction" ], "Required": false, "SortOrder": 150.0, @@ -10005,11 +10113,12 @@ "Default": false }, { - "Name": "MaxTreesAfterCompression", + "Name": "MaximumTreeCountAfterCompression", "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax" + "cmpmax", + "MaxTreesAfterCompression" ], "Required": false, "SortOrder": 150.0, @@ -10345,11 +10454,12 @@ "ShortName": "gam", "Inputs": [ { - "Name": "NumIterations", + "Name": "NumberOfIterations", "Type": "Int", "Desc": "Total number of iterations over all features", "Aliases": [ - "iter" + "iter", + "NumIterations" ], "Required": false, "SortOrder": 1.0, @@ -10388,11 +10498,12 @@ "Default": "Features" }, { - "Name": "MinDocuments", + "Name": "MinimumExampleCountPerLeaf", "Type": "Int", "Desc": "Minimum number of training instances required to form a partition", "Aliases": [ - "mi" + "mi", + "MinDocuments" ], "Required": false, "SortOrder": 3.0, @@ -10420,11 +10531,12 @@ "Default": "Label" }, { - "Name": "LearningRates", + "Name": "LearningRate", "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr" + "lr", + "LearningRates" ], "Required": false, "SortOrder": 4.0, @@ -10525,11 +10637,12 @@ "Default": 0 }, { - "Name": "NumThreads", + "Name": "NumberOfThreads", "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t" + "t", + "NumThreads" ], "Required": false, "SortOrder": 150.0, @@ -10549,11 +10662,12 @@ "Default": null }, { - "Name": "MaxBins", + "Name": "MaximumBinCountPerFeature", "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb" + "mb", + "MaxBins" ], "Required": false, "SortOrder": 150.0, @@ -10561,11 +10675,12 @@ "Default": 255 }, { - "Name": "MaxOutput", + "Name": "MaximumTreeOutput", "Type": "Float", "Desc": "Upper bound on absolute value of single output", "Aliases": [ - "mo" + "mo", + "MaxOutput" ], "Required": false, "SortOrder": 150.0, @@ -10585,11 +10700,12 @@ "Default": 1 }, { - "Name": "RngSeed", + "Name": "Seed", "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1" + "r1", + "RngSeed" ], "Required": false, "SortOrder": 150.0, @@ -10645,11 +10761,12 @@ "ShortName": "gamr", "Inputs": [ { - "Name": "NumIterations", + "Name": "NumberOfIterations", "Type": "Int", "Desc": "Total number of iterations over all features", "Aliases": [ - "iter" + "iter", + "NumIterations" ], "Required": false, "SortOrder": 1.0, @@ -10688,11 +10805,12 @@ "Default": "Features" }, { - "Name": "MinDocuments", + "Name": "MinimumExampleCountPerLeaf", "Type": "Int", "Desc": "Minimum number of training instances required to form a partition", "Aliases": [ - "mi" + "mi", + "MinDocuments" ], "Required": false, "SortOrder": 3.0, @@ -10720,11 +10838,12 @@ "Default": "Label" }, { - "Name": "LearningRates", + "Name": "LearningRate", "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr" + "lr", + "LearningRates" ], "Required": false, "SortOrder": 4.0, @@ -10825,11 +10944,12 @@ "Default": 0 }, { - "Name": "NumThreads", + "Name": "NumberOfThreads", "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t" + "t", + "NumThreads" ], "Required": false, "SortOrder": 150.0, @@ -10849,11 +10969,12 @@ "Default": null }, { - "Name": "MaxBins", + "Name": "MaximumBinCountPerFeature", "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb" + "mb", + "MaxBins" ], "Required": false, "SortOrder": 150.0, @@ -10861,11 +10982,12 @@ "Default": 255 }, { - "Name": "MaxOutput", + "Name": "MaximumTreeOutput", "Type": "Float", "Desc": "Upper bound on absolute value of single output", "Aliases": [ - "mo" + "mo", + "MaxOutput" ], "Required": false, "SortOrder": 150.0, @@ -10885,11 +11007,12 @@ "Default": 1 }, { - "Name": "RngSeed", + "Name": "Seed", "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1" + "r1", + "RngSeed" ], "Required": false, "SortOrder": 150.0, @@ -25101,11 +25224,12 @@ "FriendlyName": "FastTree (Boosted Trees) Classification", "Settings": [ { - "Name": "NumTrees", + "Name": "NumberOfTrees", "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter" + "iter", + "NumTrees" ], "Required": false, "SortOrder": 1.0, @@ -25132,11 +25256,12 @@ "IsNullable": false }, { - "Name": "NumLeaves", + "Name": "NumberOfLeaves", "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl" + "nl", + "NumLeaves" ], "Required": false, "SortOrder": 2.0, @@ -25163,11 +25288,12 @@ "Default": "Features" }, { - "Name": "MinDocumentsInLeafs", + "Name": "MinimumExampleCountPerLeaf", "Type": "Int", "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil" + "mil", + "MinDocumentsInLeafs" ], "Required": false, "SortOrder": 3.0, @@ -25195,11 +25321,12 @@ "Default": "Label" }, { - "Name": "LearningRates", + "Name": "LearningRate", "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr" + "lr", + "LearningRates" ], "Required": false, "SortOrder": 4.0, @@ -25312,11 +25439,12 @@ "Default": false }, { - "Name": "NumPostBracketSteps", + "Name": "MaximumNumberOfLineSearchSteps", "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps" + "lssteps", + "NumPostBracketSteps" ], "Required": false, "SortOrder": 150.0, @@ -25324,11 +25452,12 @@ "Default": 0 }, { - "Name": "MinStepSize", + "Name": "MinimumStepSize", "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep" + "minstep", + "MinStepSize" ], "Required": false, "SortOrder": 150.0, @@ -25494,11 +25623,12 @@ "Default": false }, { - "Name": "MaxTreeOutput", + "Name": "MaximumTreeOutput", "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo" + "mo", + "MaxTreeOutput" ], "Required": false, "SortOrder": 150.0, @@ -25583,11 +25713,12 @@ } }, { - "Name": "NumThreads", + "Name": "NumberOfThreads", "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t" + "t", + "NumThreads" ], "Required": false, "SortOrder": 150.0, @@ -25595,11 +25726,12 @@ "Default": null }, { - "Name": "RngSeed", + "Name": "Seed", "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1" + "r1", + "RngSeed" ], "Required": false, "SortOrder": 150.0, @@ -25607,11 +25739,12 @@ "Default": 123 }, { - "Name": "FeatureSelectSeed", + "Name": "FeatureSelectionSeed", "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3" + "r3", + "FeatureSelectSeed" ], "Required": false, "SortOrder": 150.0, @@ -25679,11 +25812,12 @@ "Default": false }, { - "Name": "MaxCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupsPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg" + "mcg", + "MaxCategoricalGroupsPerNode" ], "Required": false, "SortOrder": 150.0, @@ -25691,11 +25825,12 @@ "Default": 64 }, { - "Name": "MaxCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPoints", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat" + "maxcat", + "MaxCategoricalSplitPoints" ], "Required": false, "SortOrder": 150.0, @@ -25703,11 +25838,12 @@ "Default": 64 }, { - "Name": "MinDocsPercentageForCategoricalSplit", + "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", "Aliases": [ - "mdop" + "mdop", + "MinDocsPercentageForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -25715,11 +25851,12 @@ "Default": 0.001 }, { - "Name": "MinDocsForCategoricalSplit", + "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", "Desc": "Minimum categorical doc count in a bin to consider for a split.", "Aliases": [ - "mdo" + "mdo", + "MinDocsForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -25758,11 +25895,12 @@ "Default": "None" }, { - "Name": "MaxBins", + "Name": "MaximumBinCountPerFeature", "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb" + "mb", + "MaxBins" ], "Required": false, "SortOrder": 150.0, @@ -25830,11 +25968,12 @@ "Default": 0.0 }, { - "Name": "ExecutionTimes", + "Name": "ExecutionTime", "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et" + "et", + "ExecutionTimes" ], "Required": false, "SortOrder": 150.0, @@ -25866,11 +26005,12 @@ "Default": 0 }, { - "Name": "BaggingTrainFraction", + "Name": "BaggingExampleFraction", "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac" + "bagfrac", + "BaggingTrainFraction" ], "Required": false, "SortOrder": 150.0, @@ -25878,11 +26018,12 @@ "Default": 0.7 }, { - "Name": "SplitFraction", + "Name": "FeatureFractionPerSplit", "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf" + "sf", + "SplitFraction" ], "Required": false, "SortOrder": 150.0, @@ -25939,11 +26080,12 @@ "Default": false }, { - "Name": "MaxTreesAfterCompression", + "Name": "MaximumTreeCountAfterCompression", "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax" + "cmpmax", + "MaxTreesAfterCompression" ], "Required": false, "SortOrder": 150.0, @@ -25994,11 +26136,12 @@ "FriendlyName": "FastTree (Boosted Trees) Ranking", "Settings": [ { - "Name": "NumTrees", + "Name": "NumberOfTrees", "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter" + "iter", + "NumTrees" ], "Required": false, "SortOrder": 1.0, @@ -26025,11 +26168,12 @@ "IsNullable": false }, { - "Name": "NumLeaves", + "Name": "NumberOfLeaves", "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl" + "nl", + "NumLeaves" ], "Required": false, "SortOrder": 2.0, @@ -26056,11 +26200,12 @@ "Default": "Features" }, { - "Name": "MinDocumentsInLeafs", + "Name": "MinimumExampleCountPerLeaf", "Type": "Int", "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil" + "mil", + "MinDocumentsInLeafs" ], "Required": false, "SortOrder": 3.0, @@ -26088,11 +26233,12 @@ "Default": "Label" }, { - "Name": "LearningRates", + "Name": "LearningRate", "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr" + "lr", + "LearningRates" ], "Required": false, "SortOrder": 4.0, @@ -26286,11 +26432,12 @@ "Default": false }, { - "Name": "NumPostBracketSteps", + "Name": "MaximumNumberOfLineSearchSteps", "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps" + "lssteps", + "NumPostBracketSteps" ], "Required": false, "SortOrder": 150.0, @@ -26298,11 +26445,12 @@ "Default": 0 }, { - "Name": "MinStepSize", + "Name": "MinimumStepSize", "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep" + "minstep", + "MinStepSize" ], "Required": false, "SortOrder": 150.0, @@ -26468,11 +26616,12 @@ "Default": false }, { - "Name": "MaxTreeOutput", + "Name": "MaximumTreeOutput", "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo" + "mo", + "MaxTreeOutput" ], "Required": false, "SortOrder": 150.0, @@ -26557,11 +26706,12 @@ } }, { - "Name": "NumThreads", + "Name": "NumberOfThreads", "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t" + "t", + "NumThreads" ], "Required": false, "SortOrder": 150.0, @@ -26569,11 +26719,12 @@ "Default": null }, { - "Name": "RngSeed", + "Name": "Seed", "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1" + "r1", + "RngSeed" ], "Required": false, "SortOrder": 150.0, @@ -26581,11 +26732,12 @@ "Default": 123 }, { - "Name": "FeatureSelectSeed", + "Name": "FeatureSelectionSeed", "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3" + "r3", + "FeatureSelectSeed" ], "Required": false, "SortOrder": 150.0, @@ -26653,11 +26805,12 @@ "Default": false }, { - "Name": "MaxCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupsPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg" + "mcg", + "MaxCategoricalGroupsPerNode" ], "Required": false, "SortOrder": 150.0, @@ -26665,11 +26818,12 @@ "Default": 64 }, { - "Name": "MaxCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPoints", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat" + "maxcat", + "MaxCategoricalSplitPoints" ], "Required": false, "SortOrder": 150.0, @@ -26677,11 +26831,12 @@ "Default": 64 }, { - "Name": "MinDocsPercentageForCategoricalSplit", + "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", "Aliases": [ - "mdop" + "mdop", + "MinDocsPercentageForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -26689,11 +26844,12 @@ "Default": 0.001 }, { - "Name": "MinDocsForCategoricalSplit", + "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", "Desc": "Minimum categorical doc count in a bin to consider for a split.", "Aliases": [ - "mdo" + "mdo", + "MinDocsForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -26732,11 +26888,12 @@ "Default": "None" }, { - "Name": "MaxBins", + "Name": "MaximumBinCountPerFeature", "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb" + "mb", + "MaxBins" ], "Required": false, "SortOrder": 150.0, @@ -26804,11 +26961,12 @@ "Default": 0.0 }, { - "Name": "ExecutionTimes", + "Name": "ExecutionTime", "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et" + "et", + "ExecutionTimes" ], "Required": false, "SortOrder": 150.0, @@ -26840,11 +26998,12 @@ "Default": 0 }, { - "Name": "BaggingTrainFraction", + "Name": "BaggingExampleFraction", "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac" + "bagfrac", + "BaggingTrainFraction" ], "Required": false, "SortOrder": 150.0, @@ -26852,11 +27011,12 @@ "Default": 0.7 }, { - "Name": "SplitFraction", + "Name": "FeatureFractionPerSplit", "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf" + "sf", + "SplitFraction" ], "Required": false, "SortOrder": 150.0, @@ -26913,11 +27073,12 @@ "Default": false }, { - "Name": "MaxTreesAfterCompression", + "Name": "MaximumTreeCountAfterCompression", "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax" + "cmpmax", + "MaxTreesAfterCompression" ], "Required": false, "SortOrder": 150.0, @@ -26968,11 +27129,12 @@ "FriendlyName": "FastTree (Boosted Trees) Regression", "Settings": [ { - "Name": "NumTrees", + "Name": "NumberOfTrees", "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter" + "iter", + "NumTrees" ], "Required": false, "SortOrder": 1.0, @@ -26999,11 +27161,12 @@ "IsNullable": false }, { - "Name": "NumLeaves", + "Name": "NumberOfLeaves", "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl" + "nl", + "NumLeaves" ], "Required": false, "SortOrder": 2.0, @@ -27030,11 +27193,12 @@ "Default": "Features" }, { - "Name": "MinDocumentsInLeafs", + "Name": "MinimumExampleCountPerLeaf", "Type": "Int", "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil" + "mil", + "MinDocumentsInLeafs" ], "Required": false, "SortOrder": 3.0, @@ -27062,11 +27226,12 @@ "Default": "Label" }, { - "Name": "LearningRates", + "Name": "LearningRate", "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr" + "lr", + "LearningRates" ], "Required": false, "SortOrder": 4.0, @@ -27167,11 +27332,12 @@ "Default": false }, { - "Name": "NumPostBracketSteps", + "Name": "MaximumNumberOfLineSearchSteps", "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps" + "lssteps", + "NumPostBracketSteps" ], "Required": false, "SortOrder": 150.0, @@ -27179,11 +27345,12 @@ "Default": 0 }, { - "Name": "MinStepSize", + "Name": "MinimumStepSize", "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep" + "minstep", + "MinStepSize" ], "Required": false, "SortOrder": 150.0, @@ -27349,11 +27516,12 @@ "Default": false }, { - "Name": "MaxTreeOutput", + "Name": "MaximumTreeOutput", "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo" + "mo", + "MaxTreeOutput" ], "Required": false, "SortOrder": 150.0, @@ -27438,11 +27606,12 @@ } }, { - "Name": "NumThreads", + "Name": "NumberOfThreads", "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t" + "t", + "NumThreads" ], "Required": false, "SortOrder": 150.0, @@ -27450,11 +27619,12 @@ "Default": null }, { - "Name": "RngSeed", + "Name": "Seed", "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1" + "r1", + "RngSeed" ], "Required": false, "SortOrder": 150.0, @@ -27462,11 +27632,12 @@ "Default": 123 }, { - "Name": "FeatureSelectSeed", + "Name": "FeatureSelectionSeed", "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3" + "r3", + "FeatureSelectSeed" ], "Required": false, "SortOrder": 150.0, @@ -27534,11 +27705,12 @@ "Default": false }, { - "Name": "MaxCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupsPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg" + "mcg", + "MaxCategoricalGroupsPerNode" ], "Required": false, "SortOrder": 150.0, @@ -27546,11 +27718,12 @@ "Default": 64 }, { - "Name": "MaxCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPoints", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat" + "maxcat", + "MaxCategoricalSplitPoints" ], "Required": false, "SortOrder": 150.0, @@ -27558,11 +27731,12 @@ "Default": 64 }, { - "Name": "MinDocsPercentageForCategoricalSplit", + "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", "Aliases": [ - "mdop" + "mdop", + "MinDocsPercentageForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -27570,11 +27744,12 @@ "Default": 0.001 }, { - "Name": "MinDocsForCategoricalSplit", + "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", "Desc": "Minimum categorical doc count in a bin to consider for a split.", "Aliases": [ - "mdo" + "mdo", + "MinDocsForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -27613,11 +27788,12 @@ "Default": "None" }, { - "Name": "MaxBins", + "Name": "MaximumBinCountPerFeature", "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb" + "mb", + "MaxBins" ], "Required": false, "SortOrder": 150.0, @@ -27685,11 +27861,12 @@ "Default": 0.0 }, { - "Name": "ExecutionTimes", + "Name": "ExecutionTime", "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et" + "et", + "ExecutionTimes" ], "Required": false, "SortOrder": 150.0, @@ -27721,11 +27898,12 @@ "Default": 0 }, { - "Name": "BaggingTrainFraction", + "Name": "BaggingExampleFraction", "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac" + "bagfrac", + "BaggingTrainFraction" ], "Required": false, "SortOrder": 150.0, @@ -27733,11 +27911,12 @@ "Default": 0.7 }, { - "Name": "SplitFraction", + "Name": "FeatureFractionPerSplit", "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf" + "sf", + "SplitFraction" ], "Required": false, "SortOrder": 150.0, @@ -27794,11 +27973,12 @@ "Default": false }, { - "Name": "MaxTreesAfterCompression", + "Name": "MaximumTreeCountAfterCompression", "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax" + "cmpmax", + "MaxTreesAfterCompression" ], "Required": false, "SortOrder": 150.0, @@ -27849,11 +28029,12 @@ "FriendlyName": "FastTree (Boosted Trees) Tweedie Regression", "Settings": [ { - "Name": "NumTrees", + "Name": "NumberOfTrees", "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter" + "iter", + "NumTrees" ], "Required": false, "SortOrder": 1.0, @@ -27880,11 +28061,12 @@ "IsNullable": false }, { - "Name": "NumLeaves", + "Name": "NumberOfLeaves", "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl" + "nl", + "NumLeaves" ], "Required": false, "SortOrder": 2.0, @@ -27911,11 +28093,12 @@ "Default": "Features" }, { - "Name": "MinDocumentsInLeafs", + "Name": "MinimumExampleCountPerLeaf", "Type": "Int", "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil" + "mil", + "MinDocumentsInLeafs" ], "Required": false, "SortOrder": 3.0, @@ -27943,11 +28126,12 @@ "Default": "Label" }, { - "Name": "LearningRates", + "Name": "LearningRate", "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr" + "lr", + "LearningRates" ], "Required": false, "SortOrder": 4.0, @@ -28057,11 +28241,12 @@ "Default": false }, { - "Name": "NumPostBracketSteps", + "Name": "MaximumNumberOfLineSearchSteps", "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps" + "lssteps", + "NumPostBracketSteps" ], "Required": false, "SortOrder": 150.0, @@ -28069,11 +28254,12 @@ "Default": 0 }, { - "Name": "MinStepSize", + "Name": "MinimumStepSize", "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep" + "minstep", + "MinStepSize" ], "Required": false, "SortOrder": 150.0, @@ -28239,11 +28425,12 @@ "Default": false }, { - "Name": "MaxTreeOutput", + "Name": "MaximumTreeOutput", "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo" + "mo", + "MaxTreeOutput" ], "Required": false, "SortOrder": 150.0, @@ -28328,11 +28515,12 @@ } }, { - "Name": "NumThreads", + "Name": "NumberOfThreads", "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t" + "t", + "NumThreads" ], "Required": false, "SortOrder": 150.0, @@ -28340,11 +28528,12 @@ "Default": null }, { - "Name": "RngSeed", + "Name": "Seed", "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1" + "r1", + "RngSeed" ], "Required": false, "SortOrder": 150.0, @@ -28352,11 +28541,12 @@ "Default": 123 }, { - "Name": "FeatureSelectSeed", + "Name": "FeatureSelectionSeed", "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3" + "r3", + "FeatureSelectSeed" ], "Required": false, "SortOrder": 150.0, @@ -28424,11 +28614,12 @@ "Default": false }, { - "Name": "MaxCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupsPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg" + "mcg", + "MaxCategoricalGroupsPerNode" ], "Required": false, "SortOrder": 150.0, @@ -28436,11 +28627,12 @@ "Default": 64 }, { - "Name": "MaxCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPoints", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat" + "maxcat", + "MaxCategoricalSplitPoints" ], "Required": false, "SortOrder": 150.0, @@ -28448,11 +28640,12 @@ "Default": 64 }, { - "Name": "MinDocsPercentageForCategoricalSplit", + "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", "Aliases": [ - "mdop" + "mdop", + "MinDocsPercentageForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -28460,11 +28653,12 @@ "Default": 0.001 }, { - "Name": "MinDocsForCategoricalSplit", + "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", "Desc": "Minimum categorical doc count in a bin to consider for a split.", "Aliases": [ - "mdo" + "mdo", + "MinDocsForCategoricalSplit" ], "Required": false, "SortOrder": 150.0, @@ -28503,11 +28697,12 @@ "Default": "None" }, { - "Name": "MaxBins", + "Name": "MaximumBinCountPerFeature", "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb" + "mb", + "MaxBins" ], "Required": false, "SortOrder": 150.0, @@ -28575,11 +28770,12 @@ "Default": 0.0 }, { - "Name": "ExecutionTimes", + "Name": "ExecutionTime", "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et" + "et", + "ExecutionTimes" ], "Required": false, "SortOrder": 150.0, @@ -28611,11 +28807,12 @@ "Default": 0 }, { - "Name": "BaggingTrainFraction", + "Name": "BaggingExampleFraction", "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac" + "bagfrac", + "BaggingTrainFraction" ], "Required": false, "SortOrder": 150.0, @@ -28623,11 +28820,12 @@ "Default": 0.7 }, { - "Name": "SplitFraction", + "Name": "FeatureFractionPerSplit", "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf" + "sf", + "SplitFraction" ], "Required": false, "SortOrder": 150.0, @@ -28684,11 +28882,12 @@ "Default": false }, { - "Name": "MaxTreesAfterCompression", + "Name": "MaximumTreeCountAfterCompression", "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax" + "cmpmax", + "MaxTreesAfterCompression" ], "Required": false, "SortOrder": 150.0, From 01d68304a0421f9a82de5224dd48c1dc727abf04 Mon Sep 17 00:00:00 2001 From: Wei-Sheng Chin Date: Thu, 28 Feb 2019 17:26:40 -0800 Subject: [PATCH 05/12] Update F# tests --- test/Microsoft.ML.FSharp.Tests/SmokeTests.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Microsoft.ML.FSharp.Tests/SmokeTests.fs b/test/Microsoft.ML.FSharp.Tests/SmokeTests.fs index 9b20efa06c..7bf6d53db0 100644 --- a/test/Microsoft.ML.FSharp.Tests/SmokeTests.fs +++ b/test/Microsoft.ML.FSharp.Tests/SmokeTests.fs @@ -79,7 +79,7 @@ module SmokeTest1 = let data = ml.Data.LoadFromTextFile(testDataPath, hasHeader = true, allowQuoting = true) let pipeline = ml.Transforms.Text.FeaturizeText("Features", "SentimentText") - .Append(ml.BinaryClassification.Trainers.FastTree(numLeaves = 5, numTrees = 5)) + .Append(ml.BinaryClassification.Trainers.FastTree(numberOfLeaves = 5, numberOfTrees = 5)) let model = pipeline.Fit(data) @@ -119,7 +119,7 @@ module SmokeTest2 = let data = ml.Data.LoadFromTextFile(testDataPath, hasHeader = true, allowQuoting = true) let pipeline = ml.Transforms.Text.FeaturizeText("Features", "SentimentText") - .Append(ml.BinaryClassification.Trainers.FastTree(numLeaves = 5, numTrees = 5)) + .Append(ml.BinaryClassification.Trainers.FastTree(numberOfLeaves = 5, numberOfTrees = 5)) let model = pipeline.Fit(data) @@ -156,7 +156,7 @@ module SmokeTest3 = let data = ml.Data.LoadFromTextFile(testDataPath, hasHeader = true, allowQuoting = true) let pipeline = ml.Transforms.Text.FeaturizeText("Features", "SentimentText") - .Append(ml.BinaryClassification.Trainers.FastTree(numLeaves = 5, numTrees = 5)) + .Append(ml.BinaryClassification.Trainers.FastTree(numberOfLeaves = 5, numberOfTrees = 5)) let model = pipeline.Fit(data) From f323b00eba505b902148e4ebf11432fac68ff82d Mon Sep 17 00:00:00 2001 From: Wei-Sheng Chin Date: Fri, 1 Mar 2019 11:36:08 -0800 Subject: [PATCH 06/12] Address comments --- .../Static/FastTreeBinaryClassification.cs | 6 +- .../Static/FastTreeRegression.cs | 6 +- src/Microsoft.ML.FastTree/BoostingFastTree.cs | 4 +- src/Microsoft.ML.FastTree/FastTree.cs | 2 + .../FastTreeArguments.cs | 22 ++-- .../GamModelParameters.cs | 3 +- src/Microsoft.ML.FastTree/RandomForest.cs | 4 +- src/Microsoft.ML.FastTree/RegressionTree.cs | 42 +++---- .../TreeTrainersCatalog.cs | 2 +- .../TreeTrainersStatic.cs | 66 +++++----- .../Common/EntryPoints/core_manifest.json | 116 +++++++++--------- .../UnitTests/TestEntryPoints.cs | 2 +- .../Training.cs | 8 +- .../TreeRepresentation.cs | 26 ++-- .../Api/CookbookSamples/CookbookSamples.cs | 4 +- .../Api/Estimators/IntrospectiveTraining.cs | 30 ++--- 16 files changed, 172 insertions(+), 171 deletions(-) diff --git a/docs/samples/Microsoft.ML.Samples/Static/FastTreeBinaryClassification.cs b/docs/samples/Microsoft.ML.Samples/Static/FastTreeBinaryClassification.cs index 858c651e48..0480ec5015 100644 --- a/docs/samples/Microsoft.ML.Samples/Static/FastTreeBinaryClassification.cs +++ b/docs/samples/Microsoft.ML.Samples/Static/FastTreeBinaryClassification.cs @@ -78,9 +78,9 @@ public static void FastTreeBinaryClassification() Score: mlContext.BinaryClassification.Trainers.FastTree( row.Label, row.Features, - numTrees: 100, // try: (int) 20-2000 - numLeaves: 20, // try: (int) 2-128 - minDatapointsInLeaves: 10, // try: (int) 1-100 + numberOfTrees: 100, // try: (int) 20-2000 + numberOfLeaves: 20, // try: (int) 2-128 + minimumExampleCountPerLeaf: 10, // try: (int) 1-100 learningRate: 0.2))) // try: (float) 0.025-0.4 .Append(row => ( Label: row.Label, diff --git a/docs/samples/Microsoft.ML.Samples/Static/FastTreeRegression.cs b/docs/samples/Microsoft.ML.Samples/Static/FastTreeRegression.cs index c7ca0eb905..8be77fae91 100644 --- a/docs/samples/Microsoft.ML.Samples/Static/FastTreeRegression.cs +++ b/docs/samples/Microsoft.ML.Samples/Static/FastTreeRegression.cs @@ -38,9 +38,9 @@ public static void FastTreeRegression() .Append(r => (r.label, score: mlContext.Regression.Trainers.FastTree( r.label, r.features, - numTrees: 100, // try: (int) 20-2000 - numLeaves: 20, // try: (int) 2-128 - minDatapointsInLeaves: 10, // try: (int) 1-100 + numberOfTrees: 100, // try: (int) 20-2000 + numberOfLeaves: 20, // try: (int) 2-128 + minimumExampleCountPerLeaf: 10, // try: (int) 1-100 learningRate: 0.2, // try: (float) 0.025-0.4 onFit: p => pred = p) ) diff --git a/src/Microsoft.ML.FastTree/BoostingFastTree.cs b/src/Microsoft.ML.FastTree/BoostingFastTree.cs index 62cf422dee..c98c96c548 100644 --- a/src/Microsoft.ML.FastTree/BoostingFastTree.cs +++ b/src/Microsoft.ML.FastTree/BoostingFastTree.cs @@ -64,8 +64,8 @@ private protected override TreeLearner ConstructTreeLearner(IChannel ch) TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.MinimumExampleCountPerLeaf, FastTreeTrainerOptions.EntropyCoefficient, FastTreeTrainerOptions.FeatureFirstUsePenalty, FastTreeTrainerOptions.FeatureReusePenalty, FastTreeTrainerOptions.SoftmaxTemperature, FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.Seed, FastTreeTrainerOptions.FeatureFractionPerSplit, FastTreeTrainerOptions.FilterZeroLambdas, - FastTreeTrainerOptions.AllowEmptyTrees, FastTreeTrainerOptions.GainConfidenceLevel, FastTreeTrainerOptions.MaximumCategoricalGroupsPerNode, - FastTreeTrainerOptions.MaximumCategoricalSplitPoints, BsrMaxTreeOutput(), ParallelTraining, + FastTreeTrainerOptions.AllowEmptyTrees, FastTreeTrainerOptions.GainConfidenceLevel, FastTreeTrainerOptions.MaximumCategoricalGroupCountPerNode, + FastTreeTrainerOptions.MaximumCategoricalSplitPointCount, BsrMaxTreeOutput(), ParallelTraining, FastTreeTrainerOptions.MinimumExampleFractionForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinimumExamplesForCategoricalSplit, FastTreeTrainerOptions.Bias); } diff --git a/src/Microsoft.ML.FastTree/FastTree.cs b/src/Microsoft.ML.FastTree/FastTree.cs index c468315915..01a58250c2 100644 --- a/src/Microsoft.ML.FastTree/FastTree.cs +++ b/src/Microsoft.ML.FastTree/FastTree.cs @@ -3234,6 +3234,8 @@ private void ToCSharp(InternalRegressionTree tree, TextWriter writer, int node, /// /// Copy the weights of all training features to . /// + /// a where feature weights would be assigned to. + /// The i-th element in stores the weight of the i-th feature. public void GetFeatureWeights(ref VBuffer weights) { var numFeatures = Math.Max(NumFeatures, MaxSplitFeatIdx + 1); diff --git a/src/Microsoft.ML.FastTree/FastTreeArguments.cs b/src/Microsoft.ML.FastTree/FastTreeArguments.cs index 9464b36697..9b57f53979 100644 --- a/src/Microsoft.ML.FastTree/FastTreeArguments.cs +++ b/src/Microsoft.ML.FastTree/FastTreeArguments.cs @@ -165,7 +165,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId public int? NumberOfThreads = null; // this random seed is used for: - // 1. doc sampling for feature binning + // 1. example sampling for feature binning // 2. init Randomize Score // 3. grad Sampling Rate in Objective Function // 4. tree learner @@ -222,24 +222,24 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum categorical split groups to consider when splitting on a categorical feature. " + "Split groups are a collection of split points. This is used to reduce overfitting when " + "there many categorical features.", ShortName = "mcg,MaxCategoricalGroupsPerNode")] - public int MaximumCategoricalGroupsPerNode = 64; + public int MaximumCategoricalGroupCountPerNode = 64; /// /// Maximum categorical split points to consider when splitting on a categorical feature. /// [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum categorical split points to consider when splitting on a categorical feature.", ShortName = "maxcat,MaxCategoricalSplitPoints")] - public int MaximumCategoricalSplitPoints = 64; + public int MaximumCategoricalSplitPointCount = 64; /// /// Minimum categorical example percentage in a bin to consider for a split. Default is 0.1% of all training examples. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum categorical docs percentage in a bin to consider for a split.", ShortName = "mdop,MinDocsPercentageForCategoricalSplit")] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum categorical example percentage in a bin to consider for a split.", ShortName = "mdop,MinDocsPercentageForCategoricalSplit")] public double MinimumExampleFractionForCategoricalSplit = 0.001; /// /// Minimum categorical example count in a bin to consider for a split. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum categorical doc count in a bin to consider for a split.", ShortName = "mdo,MinDocsForCategoricalSplit")] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum categorical example count in a bin to consider for a split.", ShortName = "mdo,MinDocsForCategoricalSplit")] public int MinimumExamplesForCategoricalSplit = 100; /// @@ -313,11 +313,11 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId public int NumberOfLeaves = Defaults.NumberOfLeaves; /// - /// The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data. + /// The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data. /// // REVIEW: Arrays not supported in GUI // REVIEW: Different shortname than FastRank module. Same as the TLC FRWrapper. - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", ShortName = "mil,MinDocumentsInLeafs", SortOrder = 3)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", ShortName = "mil,MinDocumentsInLeafs", SortOrder = 3)] [TGUI(Description = "Minimum number of training instances required to form a leaf", SuggestedSweeps = "1,10,50")] [TlcModule.SweepableDiscreteParamAttribute("MinDocumentsInLeafs", new object[] { 1, 10, 50 })] public int MinimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf; @@ -435,8 +435,8 @@ internal virtual void Check(IExceptionContext ectx) ectx.CheckUserArg(0 <= BaggingExampleFraction && BaggingExampleFraction <= 1, nameof(BaggingExampleFraction), "Must be between 0 and 1."); ectx.CheckUserArg(0 <= FeatureFirstUsePenalty, nameof(FeatureFirstUsePenalty), "Must be non-negative."); ectx.CheckUserArg(0 <= FeatureReusePenalty, nameof(FeatureReusePenalty), "Must be non-negative."); - ectx.CheckUserArg(0 <= MaximumCategoricalGroupsPerNode, nameof(MaximumCategoricalGroupsPerNode), "Must be non-negative."); - ectx.CheckUserArg(0 <= MaximumCategoricalSplitPoints, nameof(MaximumCategoricalSplitPoints), "Must be non-negative."); + ectx.CheckUserArg(0 <= MaximumCategoricalGroupCountPerNode, nameof(MaximumCategoricalGroupCountPerNode), "Must be non-negative."); + ectx.CheckUserArg(0 <= MaximumCategoricalSplitPointCount, nameof(MaximumCategoricalSplitPointCount), "Must be non-negative."); ectx.CheckUserArg(0 <= MinimumExampleFractionForCategoricalSplit, nameof(MinimumExampleFractionForCategoricalSplit), "Must be non-negative."); ectx.CheckUserArg(0 <= MinimumExamplesForCategoricalSplit, nameof(MinimumExamplesForCategoricalSplit), "Must be non-negative."); ectx.CheckUserArg(Bundle.None <= Bundling && Bundling <= Bundle.Adjacent, nameof(Bundling), "Must be between 0 and 2."); @@ -607,9 +607,9 @@ public enum OptimizationAlgorithmType { GradientDescent, AcceleratedGradientDesc public string BaselineAlphaRisk; /// - /// The discount freeform which specifies the per position discounts of documents in a query (uses a single variable P for position where P=0 is first position). + /// The discount freeform which specifies the per position discounts of examples in a query (uses a single variable P for position where P=0 is first position). /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The discount freeform which specifies the per position discounts of documents in a query (uses a single variable P for position where P=0 is first position)", + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The discount freeform which specifies the per position discounts of examples in a query (uses a single variable P for position where P=0 is first position)", ShortName = "pdff", Hide = true)] [TGUI(NotGui = true)] public string PositionDiscountFreeform; diff --git a/src/Microsoft.ML.FastTree/GamModelParameters.cs b/src/Microsoft.ML.FastTree/GamModelParameters.cs index 8ddc66f833..61052acd43 100644 --- a/src/Microsoft.ML.FastTree/GamModelParameters.cs +++ b/src/Microsoft.ML.FastTree/GamModelParameters.cs @@ -861,8 +861,7 @@ public static FeatureInfo[] GetInfos(Context context) } /// - /// Attempts to initialize required items, from the input model file. In the event that anything goes - /// wrong, this method will throw. + /// Attempts to initialize required items, from the input model file. It could throw if something goes wrong. /// /// The channel /// A structure containing essential information about the GAM dataset that enables diff --git a/src/Microsoft.ML.FastTree/RandomForest.cs b/src/Microsoft.ML.FastTree/RandomForest.cs index 212fb972a9..efeebcb1ec 100644 --- a/src/Microsoft.ML.FastTree/RandomForest.cs +++ b/src/Microsoft.ML.FastTree/RandomForest.cs @@ -64,8 +64,8 @@ private protected override TreeLearner ConstructTreeLearner(IChannel ch) TrainSet, FastTreeTrainerOptions.NumberOfLeaves, FastTreeTrainerOptions.MinimumExampleCountPerLeaf, FastTreeTrainerOptions.EntropyCoefficient, FastTreeTrainerOptions.FeatureFirstUsePenalty, FastTreeTrainerOptions.FeatureReusePenalty, FastTreeTrainerOptions.SoftmaxTemperature, FastTreeTrainerOptions.HistogramPoolSize, FastTreeTrainerOptions.Seed, FastTreeTrainerOptions.FeatureFractionPerSplit, - FastTreeTrainerOptions.AllowEmptyTrees, FastTreeTrainerOptions.GainConfidenceLevel, FastTreeTrainerOptions.MaximumCategoricalGroupsPerNode, - FastTreeTrainerOptions.MaximumCategoricalSplitPoints, _quantileEnabled, FastTreeTrainerOptions.NumberOfQuantileSamples, ParallelTraining, + FastTreeTrainerOptions.AllowEmptyTrees, FastTreeTrainerOptions.GainConfidenceLevel, FastTreeTrainerOptions.MaximumCategoricalGroupCountPerNode, + FastTreeTrainerOptions.MaximumCategoricalSplitPointCount, _quantileEnabled, FastTreeTrainerOptions.NumberOfQuantileSamples, ParallelTraining, FastTreeTrainerOptions.MinimumExampleFractionForCategoricalSplit, FastTreeTrainerOptions.Bundling, FastTreeTrainerOptions.MinimumExamplesForCategoricalSplit, FastTreeTrainerOptions.Bias); } diff --git a/src/Microsoft.ML.FastTree/RegressionTree.cs b/src/Microsoft.ML.FastTree/RegressionTree.cs index 3d1bfbc91f..9f54935d50 100644 --- a/src/Microsoft.ML.FastTree/RegressionTree.cs +++ b/src/Microsoft.ML.FastTree/RegressionTree.cs @@ -21,11 +21,11 @@ public abstract class RegressionTreeBase private readonly InternalRegressionTree _tree; /// - /// See . + /// See . /// private readonly ImmutableArray _lteChild; /// - /// See . + /// See . /// private readonly ImmutableArray _gtChild; /// @@ -50,7 +50,7 @@ public abstract class RegressionTreeBase private readonly ImmutableArray _splitGains; /// - /// [i] is the i-th node's child index used when + /// [i] is the i-th node's child index used when /// (1) the numerical feature indexed by [i] is less than the /// threshold [i], or /// (2) the categorical features indexed by 's @@ -63,14 +63,14 @@ public abstract class RegressionTreeBase /// bitwise complement operator in C#; for details, see /// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/bitwise-complement-operator. /// - public IReadOnlyList LteChild => _lteChild; + public IReadOnlyList LessThanOrEqualToThresholdChildren => _lteChild; /// - /// [i] is the i-th node's child index used when the two conditions, (1) and (2), - /// described in 's document are not true. Its return value follows the format - /// used in . + /// [i] is the i-th node's child index used when the two conditions, (1) and (2), + /// described in 's document are not true. Its return value follows the format + /// used in . /// - public IReadOnlyList GtChild => _gtChild; + public IReadOnlyList GreaterThanThresholdChildren => _gtChild; /// /// [i] is the feature index used the splitting function of the @@ -99,13 +99,13 @@ public abstract class RegressionTreeBase /// /// Return categorical thresholds used at node indexed by nodeIndex. If the considered input feature does NOT /// matche any of values returned by , we call it a - /// less-than-threshold event and therefore [nodeIndex] is the child node that input + /// less-than-threshold event and therefore [nodeIndex] is the child node that input /// should go next. The returned value is valid only if [nodeIndex] is true. /// public IReadOnlyList GetCategoricalSplitFeaturesAt(int nodeIndex) { - if (nodeIndex < 0 || nodeIndex >= NumNodes) - throw Contracts.Except($"The input index, {nodeIndex}, is invalid. Its valid range is from 0 (inclusive) to {NumNodes} (exclusive)."); + if (nodeIndex < 0 || nodeIndex >= NumberOfNodes) + throw Contracts.Except($"The input index, {nodeIndex}, is invalid. Its valid range is from 0 (inclusive) to {NumberOfNodes} (exclusive)."); if (_tree.CategoricalSplitFeatures == null || _tree.CategoricalSplitFeatures[nodeIndex] == null) return new List(); // Zero-length vector. @@ -121,8 +121,8 @@ public IReadOnlyList GetCategoricalSplitFeaturesAt(int nodeIndex) /// public IReadOnlyList GetCategoricalCategoricalSplitFeatureRangeAt(int nodeIndex) { - if (nodeIndex < 0 || nodeIndex >= NumNodes) - throw Contracts.Except($"The input node index, {nodeIndex}, is invalid. Its valid range is from 0 (inclusive) to {NumNodes} (exclusive)."); + if (nodeIndex < 0 || nodeIndex >= NumberOfNodes) + throw Contracts.Except($"The input node index, {nodeIndex}, is invalid. Its valid range is from 0 (inclusive) to {NumberOfNodes} (exclusive)."); if (_tree.CategoricalSplitFeatureRanges == null || _tree.CategoricalSplitFeatureRanges[nodeIndex] == null) return new List(); // Zero-length vector. @@ -136,13 +136,13 @@ public IReadOnlyList GetCategoricalCategoricalSplitFeatureRangeAt(int nodeI public IReadOnlyList SplitGains => _splitGains; /// - /// Number of leaves in the tree. Note that does not take non-leaf nodes into account. + /// Number of leaves in the tree. Note that does not take non-leaf nodes into account. /// - public int NumLeaves => _tree.NumLeaves; + public int NumberOfLeaves => _tree.NumLeaves; /// /// Number of nodes in the tree. This doesn't include any leaves. For example, a tree with node0->node1, - /// node0->leaf3, node1->leaf1, node1->leaf2, and should + /// node0->leaf3, node1->leaf1, node1->leaf2, and should /// be 2 and 3, respectively. /// // A visualization of the example mentioned in this doc string. @@ -152,7 +152,7 @@ public IReadOnlyList GetCategoricalCategoricalSplitFeatureRangeAt(int nodeI // / \ // leaf1 leaf2 // The index of leaf starts with 1 because interally we use "-1" as the 1st leaf's index, "-2" for the 2nd leaf's index, and so on. - public int NumNodes => _tree.NumNodes; + public int NumberOfNodes => _tree.NumNodes; internal RegressionTreeBase(InternalRegressionTree tree) { @@ -209,8 +209,8 @@ public sealed class QuantileRegressionTree : RegressionTreeBase /// Training labels public IReadOnlyList GetLeafSamplesAt(int leafIndex) { - if (leafIndex < 0 || leafIndex >= NumLeaves) - throw Contracts.Except($"The input leaf index, {leafIndex}, is invalid. Its valid range is from 0 (inclusive) to {NumLeaves} (exclusive)."); + if (leafIndex < 0 || leafIndex >= NumberOfLeaves) + throw Contracts.Except($"The input leaf index, {leafIndex}, is invalid. Its valid range is from 0 (inclusive) to {NumberOfLeaves} (exclusive)."); // _leafSample always contains valid values assigned in constructor. return _leafSamples[leafIndex]; @@ -225,8 +225,8 @@ public IReadOnlyList GetLeafSamplesAt(int leafIndex) /// Training labels' weights public IReadOnlyList GetLeafSampleWeightsAt(int leafIndex) { - if (leafIndex < 0 || leafIndex >= NumLeaves) - throw Contracts.Except($"The input leaf index, {leafIndex}, is invalid. Its valid range is from 0 (inclusive) to {NumLeaves} (exclusive)."); + if (leafIndex < 0 || leafIndex >= NumberOfLeaves) + throw Contracts.Except($"The input leaf index, {leafIndex}, is invalid. Its valid range is from 0 (inclusive) to {NumberOfLeaves} (exclusive)."); // _leafSampleWeights always contains valid values assigned in constructor. return _leafSampleWeights[leafIndex]; diff --git a/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs b/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs index e32caeb9c7..79c626c470 100644 --- a/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs +++ b/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs @@ -102,7 +102,7 @@ public static FastTreeBinaryClassificationTrainer FastTree(this BinaryClassifica /// The name of the example weight column (optional). /// Total number of decision trees to create in the ensemble. /// The maximum number of leaves per decision tree. - /// The minimal number of datapoints allowed in a leaf of the tree, out of the subsampled data. + /// The minimal number of data points allowed in a leaf of the tree, out of the subsampled data. /// The learning rate. public static FastTreeRankingTrainer FastTree(this RankingCatalog.RankingTrainers catalog, string labelColumnName = DefaultColumnNames.Label, diff --git a/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs b/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs index bbd639dc2b..8e2b08d3d7 100644 --- a/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs +++ b/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs @@ -21,9 +21,9 @@ public static class TreeRegressionExtensions /// The label column. /// The features column. /// The optional weights column. - /// Total number of decision trees to create in the ensemble. - /// The maximum number of leaves per decision tree. - /// The minimal number of datapoints allowed in a leaf of a regression tree, out of the subsampled data. + /// Total number of decision trees to create in the ensemble. + /// The maximum number of leaves per decision tree. + /// The minimal number of data points allowed in a leaf of a regression tree, out of the subsampled data. /// The learning rate. /// A delegate that is called every time the /// method is called on the @@ -39,19 +39,19 @@ public static class TreeRegressionExtensions /// public static Scalar FastTree(this RegressionCatalog.RegressionTrainers catalog, Scalar label, Vector features, Scalar weights = null, - int numLeaves = Defaults.NumberOfLeaves, - int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, + int numberOfLeaves = Defaults.NumberOfLeaves, + int numberOfTrees = Defaults.NumberOfTrees, + int minimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate, Action onFit = null) { - CheckUserValues(label, features, weights, numLeaves, numTrees, minDatapointsInLeaves, learningRate, onFit); + CheckUserValues(label, features, weights, numberOfLeaves, numberOfTrees, minimumExampleCountPerLeaf, learningRate, onFit); var rec = new TrainerEstimatorReconciler.Regression( (env, labelName, featuresName, weightsName) => { - var trainer = new FastTreeRegressionTrainer(env, labelName, featuresName, weightsName, numLeaves, - numTrees, minDatapointsInLeaves, learningRate); + var trainer = new FastTreeRegressionTrainer(env, labelName, featuresName, weightsName, numberOfLeaves, + numberOfTrees, minimumExampleCountPerLeaf, learningRate); if (onFit != null) return trainer.WithOnFitDelegate(trans => onFit(trans.Model)); return trainer; @@ -113,9 +113,9 @@ public static Scalar FastTree(this RegressionCatalog.RegressionTrainers c /// The label column. /// The features column. /// The optional weights column. - /// Total number of decision trees to create in the ensemble. - /// The maximum number of leaves per decision tree. - /// The minimal number of datapoints allowed in a leaf of the tree, out of the subsampled data. + /// Total number of decision trees to create in the ensemble. + /// The maximum number of leaves per decision tree. + /// The minimal number of data points allowed in a leaf of the tree, out of the subsampled data. /// The learning rate. /// A delegate that is called every time the /// method is called on the @@ -132,19 +132,19 @@ public static Scalar FastTree(this RegressionCatalog.RegressionTrainers c /// public static (Scalar score, Scalar probability, Scalar predictedLabel) FastTree(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, Scalar label, Vector features, Scalar weights = null, - int numLeaves = Defaults.NumberOfLeaves, - int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, + int numberOfLeaves = Defaults.NumberOfLeaves, + int numberOfTrees = Defaults.NumberOfTrees, + int minimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate, Action> onFit = null) { - CheckUserValues(label, features, weights, numLeaves, numTrees, minDatapointsInLeaves, learningRate, onFit); + CheckUserValues(label, features, weights, numberOfLeaves, numberOfTrees, minimumExampleCountPerLeaf, learningRate, onFit); var rec = new TrainerEstimatorReconciler.BinaryClassifier( (env, labelName, featuresName, weightsName) => { - var trainer = new FastTreeBinaryClassificationTrainer(env, labelName, featuresName, weightsName, numLeaves, - numTrees, minDatapointsInLeaves, learningRate); + var trainer = new FastTreeBinaryClassificationTrainer(env, labelName, featuresName, weightsName, numberOfLeaves, + numberOfTrees, minimumExampleCountPerLeaf, learningRate); if (onFit != null) return trainer.WithOnFitDelegate(trans => onFit(trans.Model)); @@ -212,9 +212,9 @@ public static (Scalar score, Scalar probability, Scalar pred /// The features column. /// The groupId column. /// The optional weights column. - /// Total number of decision trees to create in the ensemble. - /// The maximum number of leaves per decision tree. - /// The minimal number of datapoints allowed in a leaf of a regression tree, out of the subsampled data. + /// Total number of decision trees to create in the ensemble. + /// The maximum number of leaves per decision tree. + /// The minimal number of data points allowed in a leaf of a regression tree, out of the subsampled data. /// The learning rate. /// A delegate that is called every time the /// method is called on the @@ -224,19 +224,19 @@ public static (Scalar score, Scalar probability, Scalar pred /// The Score output column indicating the predicted value. public static Scalar FastTree(this RankingCatalog.RankingTrainers catalog, Scalar label, Vector features, Key groupId, Scalar weights = null, - int numLeaves = Defaults.NumberOfLeaves, - int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, + int numberOfLeaves = Defaults.NumberOfLeaves, + int numberOfTrees = Defaults.NumberOfTrees, + int minimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate, Action onFit = null) { - CheckUserValues(label, features, weights, numLeaves, numTrees, minDatapointsInLeaves, learningRate, onFit); + CheckUserValues(label, features, weights, numberOfLeaves, numberOfTrees, minimumExampleCountPerLeaf, learningRate, onFit); var rec = new TrainerEstimatorReconciler.Ranker( (env, labelName, featuresName, groupIdName, weightsName) => { - var trainer = new FastTreeRankingTrainer(env, labelName, featuresName, groupIdName, weightsName, numLeaves, - numTrees, minDatapointsInLeaves, learningRate); + var trainer = new FastTreeRankingTrainer(env, labelName, featuresName, groupIdName, weightsName, numberOfLeaves, + numberOfTrees, minimumExampleCountPerLeaf, learningRate); if (onFit != null) return trainer.WithOnFitDelegate(trans => onFit(trans.Model)); return trainer; @@ -287,18 +287,18 @@ public static Scalar FastTree(this RankingCatalog.RankingTrainers c } internal static void CheckUserValues(PipelineColumn label, Vector features, Scalar weights, - int numLeaves, - int numTrees, - int minDatapointsInLeaves, + int numberOfLeaves, + int numberOfTrees, + int minimumExampleCountPerLeaf, double learningRate, Delegate onFit) { Contracts.CheckValue(label, nameof(label)); Contracts.CheckValue(features, nameof(features)); Contracts.CheckValueOrNull(weights); - Contracts.CheckParam(numLeaves >= 2, nameof(numLeaves), "Must be at least 2."); - Contracts.CheckParam(numTrees > 0, nameof(numTrees), "Must be positive"); - Contracts.CheckParam(minDatapointsInLeaves > 0, nameof(minDatapointsInLeaves), "Must be positive"); + Contracts.CheckParam(numberOfLeaves >= 2, nameof(numberOfLeaves), "Must be at least 2."); + Contracts.CheckParam(numberOfTrees > 0, nameof(numberOfTrees), "Must be positive"); + Contracts.CheckParam(minimumExampleCountPerLeaf > 0, nameof(minimumExampleCountPerLeaf), "Must be positive"); Contracts.CheckParam(learningRate > 0, nameof(learningRate), "Must be positive"); Contracts.CheckValueOrNull(onFit); } diff --git a/test/BaselineOutput/Common/EntryPoints/core_manifest.json b/test/BaselineOutput/Common/EntryPoints/core_manifest.json index 6d3479dde2..8940a4b992 100644 --- a/test/BaselineOutput/Common/EntryPoints/core_manifest.json +++ b/test/BaselineOutput/Common/EntryPoints/core_manifest.json @@ -5160,7 +5160,7 @@ { "Name": "MinimumExampleCountPerLeaf", "Type": "Int", - "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", + "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ "mil", "MinDocumentsInLeafs" @@ -5419,7 +5419,7 @@ "Default": false }, { - "Name": "MaximumCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupCountPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ @@ -5432,7 +5432,7 @@ "Default": 64 }, { - "Name": "MaximumCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPointCount", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ @@ -5447,7 +5447,7 @@ { "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", - "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", + "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ "mdop", "MinDocsPercentageForCategoricalSplit" @@ -5460,7 +5460,7 @@ { "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", - "Desc": "Minimum categorical doc count in a bin to consider for a split.", + "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ "mdo", "MinDocsForCategoricalSplit" @@ -5827,7 +5827,7 @@ { "Name": "MinimumExampleCountPerLeaf", "Type": "Int", - "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", + "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ "mil", "MinDocumentsInLeafs" @@ -6059,7 +6059,7 @@ "Default": false }, { - "Name": "MaximumCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupCountPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ @@ -6072,7 +6072,7 @@ "Default": 64 }, { - "Name": "MaximumCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPointCount", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ @@ -6087,7 +6087,7 @@ { "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", - "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", + "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ "mdop", "MinDocsPercentageForCategoricalSplit" @@ -6100,7 +6100,7 @@ { "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", - "Desc": "Minimum categorical doc count in a bin to consider for a split.", + "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ "mdo", "MinDocsForCategoricalSplit" @@ -6467,7 +6467,7 @@ { "Name": "MinimumExampleCountPerLeaf", "Type": "Int", - "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", + "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ "mil", "MinDocumentsInLeafs" @@ -6863,7 +6863,7 @@ { "Name": "PositionDiscountFreeform", "Type": "String", - "Desc": "The discount freeform which specifies the per position discounts of documents in a query (uses a single variable P for position where P=0 is first position)", + "Desc": "The discount freeform which specifies the per position discounts of examples in a query (uses a single variable P for position where P=0 is first position)", "Aliases": [ "pdff" ], @@ -6989,7 +6989,7 @@ "Default": false }, { - "Name": "MaximumCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupCountPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ @@ -7002,7 +7002,7 @@ "Default": 64 }, { - "Name": "MaximumCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPointCount", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ @@ -7017,7 +7017,7 @@ { "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", - "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", + "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ "mdop", "MinDocsPercentageForCategoricalSplit" @@ -7030,7 +7030,7 @@ { "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", - "Desc": "Minimum categorical doc count in a bin to consider for a split.", + "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ "mdo", "MinDocsForCategoricalSplit" @@ -7397,7 +7397,7 @@ { "Name": "MinimumExampleCountPerLeaf", "Type": "Int", - "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", + "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ "mil", "MinDocumentsInLeafs" @@ -7874,7 +7874,7 @@ { "Name": "PositionDiscountFreeform", "Type": "String", - "Desc": "The discount freeform which specifies the per position discounts of documents in a query (uses a single variable P for position where P=0 is first position)", + "Desc": "The discount freeform which specifies the per position discounts of examples in a query (uses a single variable P for position where P=0 is first position)", "Aliases": [ "pdff" ], @@ -8000,7 +8000,7 @@ "Default": false }, { - "Name": "MaximumCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupCountPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ @@ -8013,7 +8013,7 @@ "Default": 64 }, { - "Name": "MaximumCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPointCount", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ @@ -8028,7 +8028,7 @@ { "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", - "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", + "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ "mdop", "MinDocsPercentageForCategoricalSplit" @@ -8041,7 +8041,7 @@ { "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", - "Desc": "Minimum categorical doc count in a bin to consider for a split.", + "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ "mdo", "MinDocsForCategoricalSplit" @@ -8408,7 +8408,7 @@ { "Name": "MinimumExampleCountPerLeaf", "Type": "Int", - "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", + "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ "mil", "MinDocumentsInLeafs" @@ -8792,7 +8792,7 @@ { "Name": "PositionDiscountFreeform", "Type": "String", - "Desc": "The discount freeform which specifies the per position discounts of documents in a query (uses a single variable P for position where P=0 is first position)", + "Desc": "The discount freeform which specifies the per position discounts of examples in a query (uses a single variable P for position where P=0 is first position)", "Aliases": [ "pdff" ], @@ -8918,7 +8918,7 @@ "Default": false }, { - "Name": "MaximumCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupCountPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ @@ -8931,7 +8931,7 @@ "Default": 64 }, { - "Name": "MaximumCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPointCount", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ @@ -8946,7 +8946,7 @@ { "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", - "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", + "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ "mdop", "MinDocsPercentageForCategoricalSplit" @@ -8959,7 +8959,7 @@ { "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", - "Desc": "Minimum categorical doc count in a bin to consider for a split.", + "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ "mdo", "MinDocsForCategoricalSplit" @@ -9326,7 +9326,7 @@ { "Name": "MinimumExampleCountPerLeaf", "Type": "Int", - "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", + "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ "mil", "MinDocumentsInLeafs" @@ -9719,7 +9719,7 @@ { "Name": "PositionDiscountFreeform", "Type": "String", - "Desc": "The discount freeform which specifies the per position discounts of documents in a query (uses a single variable P for position where P=0 is first position)", + "Desc": "The discount freeform which specifies the per position discounts of examples in a query (uses a single variable P for position where P=0 is first position)", "Aliases": [ "pdff" ], @@ -9845,7 +9845,7 @@ "Default": false }, { - "Name": "MaximumCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupCountPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ @@ -9858,7 +9858,7 @@ "Default": 64 }, { - "Name": "MaximumCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPointCount", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ @@ -9873,7 +9873,7 @@ { "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", - "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", + "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ "mdop", "MinDocsPercentageForCategoricalSplit" @@ -9886,7 +9886,7 @@ { "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", - "Desc": "Minimum categorical doc count in a bin to consider for a split.", + "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ "mdo", "MinDocsForCategoricalSplit" @@ -25290,7 +25290,7 @@ { "Name": "MinimumExampleCountPerLeaf", "Type": "Int", - "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", + "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ "mil", "MinDocumentsInLeafs" @@ -25686,7 +25686,7 @@ { "Name": "PositionDiscountFreeform", "Type": "String", - "Desc": "The discount freeform which specifies the per position discounts of documents in a query (uses a single variable P for position where P=0 is first position)", + "Desc": "The discount freeform which specifies the per position discounts of examples in a query (uses a single variable P for position where P=0 is first position)", "Aliases": [ "pdff" ], @@ -25812,7 +25812,7 @@ "Default": false }, { - "Name": "MaximumCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupCountPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ @@ -25825,7 +25825,7 @@ "Default": 64 }, { - "Name": "MaximumCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPointCount", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ @@ -25840,7 +25840,7 @@ { "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", - "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", + "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ "mdop", "MinDocsPercentageForCategoricalSplit" @@ -25853,7 +25853,7 @@ { "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", - "Desc": "Minimum categorical doc count in a bin to consider for a split.", + "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ "mdo", "MinDocsForCategoricalSplit" @@ -26202,7 +26202,7 @@ { "Name": "MinimumExampleCountPerLeaf", "Type": "Int", - "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", + "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ "mil", "MinDocumentsInLeafs" @@ -26679,7 +26679,7 @@ { "Name": "PositionDiscountFreeform", "Type": "String", - "Desc": "The discount freeform which specifies the per position discounts of documents in a query (uses a single variable P for position where P=0 is first position)", + "Desc": "The discount freeform which specifies the per position discounts of examples in a query (uses a single variable P for position where P=0 is first position)", "Aliases": [ "pdff" ], @@ -26805,7 +26805,7 @@ "Default": false }, { - "Name": "MaximumCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupCountPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ @@ -26818,7 +26818,7 @@ "Default": 64 }, { - "Name": "MaximumCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPointCount", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ @@ -26833,7 +26833,7 @@ { "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", - "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", + "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ "mdop", "MinDocsPercentageForCategoricalSplit" @@ -26846,7 +26846,7 @@ { "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", - "Desc": "Minimum categorical doc count in a bin to consider for a split.", + "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ "mdo", "MinDocsForCategoricalSplit" @@ -27195,7 +27195,7 @@ { "Name": "MinimumExampleCountPerLeaf", "Type": "Int", - "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", + "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ "mil", "MinDocumentsInLeafs" @@ -27579,7 +27579,7 @@ { "Name": "PositionDiscountFreeform", "Type": "String", - "Desc": "The discount freeform which specifies the per position discounts of documents in a query (uses a single variable P for position where P=0 is first position)", + "Desc": "The discount freeform which specifies the per position discounts of examples in a query (uses a single variable P for position where P=0 is first position)", "Aliases": [ "pdff" ], @@ -27705,7 +27705,7 @@ "Default": false }, { - "Name": "MaximumCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupCountPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ @@ -27718,7 +27718,7 @@ "Default": 64 }, { - "Name": "MaximumCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPointCount", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ @@ -27733,7 +27733,7 @@ { "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", - "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", + "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ "mdop", "MinDocsPercentageForCategoricalSplit" @@ -27746,7 +27746,7 @@ { "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", - "Desc": "Minimum categorical doc count in a bin to consider for a split.", + "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ "mdo", "MinDocsForCategoricalSplit" @@ -28095,7 +28095,7 @@ { "Name": "MinimumExampleCountPerLeaf", "Type": "Int", - "Desc": "The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data", + "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ "mil", "MinDocumentsInLeafs" @@ -28488,7 +28488,7 @@ { "Name": "PositionDiscountFreeform", "Type": "String", - "Desc": "The discount freeform which specifies the per position discounts of documents in a query (uses a single variable P for position where P=0 is first position)", + "Desc": "The discount freeform which specifies the per position discounts of examples in a query (uses a single variable P for position where P=0 is first position)", "Aliases": [ "pdff" ], @@ -28614,7 +28614,7 @@ "Default": false }, { - "Name": "MaximumCategoricalGroupsPerNode", + "Name": "MaximumCategoricalGroupCountPerNode", "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ @@ -28627,7 +28627,7 @@ "Default": 64 }, { - "Name": "MaximumCategoricalSplitPoints", + "Name": "MaximumCategoricalSplitPointCount", "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ @@ -28642,7 +28642,7 @@ { "Name": "MinimumExampleFractionForCategoricalSplit", "Type": "Float", - "Desc": "Minimum categorical docs percentage in a bin to consider for a split.", + "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ "mdop", "MinDocsPercentageForCategoricalSplit" @@ -28655,7 +28655,7 @@ { "Name": "MinimumExamplesForCategoricalSplit", "Type": "Int", - "Desc": "Minimum categorical doc count in a bin to consider for a split.", + "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ "mdo", "MinDocsForCategoricalSplit" diff --git a/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs b/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs index d92db665ca..3b6613390f 100644 --- a/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs +++ b/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs @@ -225,7 +225,7 @@ private string GetBuildPrefix() #endif } - [Fact(Skip = "Execute this test if you want to regenerate the core_manifest and core_ep_list files")] + [Fact] public void RegenerateEntryPointCatalog() { var (epListContents, jObj) = BuildManifests(); diff --git a/test/Microsoft.ML.StaticPipelineTesting/Training.cs b/test/Microsoft.ML.StaticPipelineTesting/Training.cs index a62355e94a..a4c65f6670 100644 --- a/test/Microsoft.ML.StaticPipelineTesting/Training.cs +++ b/test/Microsoft.ML.StaticPipelineTesting/Training.cs @@ -453,8 +453,8 @@ public void FastTreeBinaryClassification() var est = reader.MakeNewEstimator() .Append(r => (r.label, preds: catalog.Trainers.FastTree(r.label, r.features, - numTrees: 10, - numLeaves: 5, + numberOfTrees: 10, + numberOfLeaves: 5, onFit: (p) => { pred = p; }))); var pipe = reader.Append(est); @@ -494,8 +494,8 @@ public void FastTreeRegression() var est = reader.MakeNewEstimator() .Append(r => (r.label, score: catalog.Trainers.FastTree(r.label, r.features, - numTrees: 10, - numLeaves: 5, + numberOfTrees: 10, + numberOfLeaves: 5, onFit: (p) => { pred = p; }))); var pipe = reader.Append(est); diff --git a/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs b/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs index 01592f29cd..79f640b618 100644 --- a/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs +++ b/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs @@ -51,7 +51,7 @@ public void FastTreeRegressionRepresentation() Assert.Equal(10, treeCollection.TreeWeights.Count); var trees = treeCollection.Trees; - Assert.Equal(4, trees[0].NumNodes); + Assert.Equal(4, trees[0].NumberOfNodes); // Numerical split. There is no categorical split so the follwoing vector contains 0-element. var categoricalSplitFeatures = trees[0].GetCategoricalSplitFeaturesAt(0); @@ -62,12 +62,12 @@ public void FastTreeRegressionRepresentation() Assert.Equal(0, categoricalSplitFeatureRange.Count); var expectedGtChild = new int[] { 3, 2, -4, -5 }; - Assert.Equal(4, trees[0].GtChild.Count); - Assert.Equal(expectedGtChild, trees[0].GtChild); + Assert.Equal(4, trees[0].GreaterThanThresholdChildren.Count); + Assert.Equal(expectedGtChild, trees[0].GreaterThanThresholdChildren); var expectedLteChild = new int[] { 1, -1, -3, -2 }; - Assert.Equal(4, trees[0].LteChild.Count); - Assert.Equal(expectedLteChild, trees[0].LteChild); + Assert.Equal(4, trees[0].LessThanOrEqualToThresholdChildren.Count); + Assert.Equal(expectedLteChild, trees[0].LessThanOrEqualToThresholdChildren); var expectedCategoricalSplitFlags = new bool[] { false, false, false, false }; Assert.Equal(4, trees[0].CategoricalSplitFlags.Count); @@ -82,7 +82,7 @@ public void FastTreeRegressionRepresentation() for (int i = 0; i < trees[0].NumericalSplitThresholds.Count; ++i) Assert.Equal(expectedNumericalSplitThresholds[i], trees[0].NumericalSplitThresholds[i], 6); - Assert.Equal(5, trees[0].NumLeaves); + Assert.Equal(5, trees[0].NumberOfLeaves); var expectedLeafValues = new double[] { 40.159015006449692, 80.434805844435061, 57.072130551545513, 82.898710076162757, 104.17547955322266 }; Assert.Equal(5, trees[0].LeafValues.Count); @@ -133,15 +133,15 @@ public void FastTreeRegressionRepresentationWithCategoricalSplit() Assert.Equal(3, treeCollection.TreeWeights.Count); var trees = treeCollection.Trees; - Assert.Equal(4, trees[0].NumNodes); + Assert.Equal(4, trees[0].NumberOfNodes); var expectedGtChild = new int[] { 3, -3, -4, -5 }; - Assert.Equal(4, trees[0].GtChild.Count); - Assert.Equal(expectedGtChild, trees[0].GtChild); + Assert.Equal(4, trees[0].GreaterThanThresholdChildren.Count); + Assert.Equal(expectedGtChild, trees[0].GreaterThanThresholdChildren); var expectedLteChild = new int[] { 1, 2, -1, -2 }; - Assert.Equal(4, trees[0].LteChild.Count); - Assert.Equal(expectedLteChild, trees[0].LteChild); + Assert.Equal(4, trees[0].LessThanOrEqualToThresholdChildren.Count); + Assert.Equal(expectedLteChild, trees[0].LessThanOrEqualToThresholdChildren); var expectedCategoricalSplitFlags = new bool[] { true, true, true, true }; Assert.Equal(4, trees[0].CategoricalSplitFlags.Count); @@ -171,7 +171,7 @@ public void FastTreeRegressionRepresentationWithCategoricalSplit() int[] expectedCounts = { 62, 52, 54, 22 }; int[] expectedStarts = { 5315, 10, 2141, 533 }; int[] expectedEnds = { 5782, 401, 2558, 874 }; - for (int i = 0; i < trees[0].NumNodes; ++i) + for (int i = 0; i < trees[0].NumberOfNodes; ++i) { // Retrieve i-th node's split features. var actualCategoricalSplitFeatures = trees[0].GetCategoricalSplitFeaturesAt(i); @@ -180,7 +180,7 @@ public void FastTreeRegressionRepresentationWithCategoricalSplit() Assert.Equal(expectedEnds[i], actualCategoricalSplitFeatures[expectedCounts[i] - 1]); } - Assert.Equal(5, trees[0].NumLeaves); + Assert.Equal(5, trees[0].NumberOfLeaves); var expectedLeafValues = new double[] { 48.456055413607892, 86.584156799316418, 87.017326642027, 76.381184971185391, 117.68872643673058 }; Assert.Equal(5, trees[0].LeafValues.Count); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/CookbookSamples/CookbookSamples.cs b/test/Microsoft.ML.Tests/Scenarios/Api/CookbookSamples/CookbookSamples.cs index 24f311533a..c1444b3baf 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/CookbookSamples/CookbookSamples.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/CookbookSamples/CookbookSamples.cs @@ -422,7 +422,7 @@ public void TrainOnAutoGeneratedData() r.HasChurned, Features: r.DemographicCategory.OneHotEncoding().ConcatWith(r.LastVisits))) .AppendCacheCheckpoint() // FastTree will benefit from caching data in memory. - .Append(r => mlContext.BinaryClassification.Trainers.FastTree(r.HasChurned, r.Features, numTrees: 20)); + .Append(r => mlContext.BinaryClassification.Trainers.FastTree(r.HasChurned, r.Features, numberOfTrees: 20)); var staticModel = staticpipeline.Fit(staticData); @@ -550,7 +550,7 @@ private void CategoricalFeaturizationOn(params string[] dataPath) // Concatenate two of the 3 categorical pipelines, and the numeric features. Features: r.NumericalFeatures.ConcatWith(r.CategoricalBag, r.WorkclassOneHotTrimmed))) // Now we're ready to train. We chose our FastTree trainer for this classification task. - .Append(r => mlContext.BinaryClassification.Trainers.FastTree(r.Label, r.Features, numTrees: 50)); + .Append(r => mlContext.BinaryClassification.Trainers.FastTree(r.Label, r.Features, numberOfTrees: 50)); // Train the model. var model = fullpipeline.Fit(data); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs index 0cf18bb2f4..d9f7221c5b 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs @@ -74,16 +74,16 @@ public void FastTreeClassificationIntrospectiveTraining() // Inspect the last tree. var tree = treeCollection.Trees[2]; - Assert.Equal(5, tree.NumLeaves); - Assert.Equal(4, tree.NumNodes); - Assert.Equal(tree.LteChild, new int[] { 2, -2, -1, -3 }); - Assert.Equal(tree.GtChild, new int[] { 1, 3, -4, -5 }); + Assert.Equal(5, tree.NumberOfLeaves); + Assert.Equal(4, tree.NumberOfNodes); + Assert.Equal(tree.LessThanOrEqualToThresholdChildren, new int[] { 2, -2, -1, -3 }); + Assert.Equal(tree.GreaterThanThresholdChildren, new int[] { 1, 3, -4, -5 }); Assert.Equal(tree.NumericalSplitFeatureIndexes, new int[] { 14, 294, 633, 266 }); - Assert.Equal(tree.SplitGains.Count, tree.NumNodes); - Assert.Equal(tree.NumericalSplitThresholds.Count, tree.NumNodes); + Assert.Equal(tree.SplitGains.Count, tree.NumberOfNodes); + Assert.Equal(tree.NumericalSplitThresholds.Count, tree.NumberOfNodes); var expectedSplitGains = new double[] { 0.52634223978445616, 0.45899249367725858, 0.44142707650267105, 0.38348634823264854 }; var expectedThresholds = new float[] { 0.0911167f, 0.06509889f, 0.019873254f, 0.0361835f }; - for (int i = 0; i < tree.NumNodes; ++i) + for (int i = 0; i < tree.NumberOfNodes; ++i) { Assert.Equal(expectedSplitGains[i], tree.SplitGains[i], 6); Assert.Equal(expectedThresholds[i], tree.NumericalSplitThresholds[i], 6); @@ -119,16 +119,16 @@ public void FastForestRegressionIntrospectiveTraining() // Inspect the last tree. var tree = treeCollection.Trees[2]; - Assert.Equal(5, tree.NumLeaves); - Assert.Equal(4, tree.NumNodes); - Assert.Equal(tree.LteChild, new int[] { -1, -2, -3, -4 }); - Assert.Equal(tree.GtChild, new int[] { 1, 2, 3, -5 }); + Assert.Equal(5, tree.NumberOfLeaves); + Assert.Equal(4, tree.NumberOfNodes); + Assert.Equal(tree.LessThanOrEqualToThresholdChildren, new int[] { -1, -2, -3, -4 }); + Assert.Equal(tree.GreaterThanThresholdChildren, new int[] { 1, 2, 3, -5 }); Assert.Equal(tree.NumericalSplitFeatureIndexes, new int[] { 9, 0, 1, 8 }); - Assert.Equal(tree.SplitGains.Count, tree.NumNodes); - Assert.Equal(tree.NumericalSplitThresholds.Count, tree.NumNodes); + Assert.Equal(tree.SplitGains.Count, tree.NumberOfNodes); + Assert.Equal(tree.NumericalSplitThresholds.Count, tree.NumberOfNodes); var expectedSplitGains = new double[] { 21.279269008093962, 19.376698810984138, 17.830020749728774, 17.366801337893413 }; var expectedThresholds = new float[] { 0.208134219f, 0.198336035f, 0.202952743f, 0.205061346f }; - for (int i = 0; i < tree.NumNodes; ++i) + for (int i = 0; i < tree.NumberOfNodes; ++i) { Assert.Equal(expectedSplitGains[i], tree.SplitGains[i], 6); Assert.Equal(expectedThresholds[i], tree.NumericalSplitThresholds[i], 6); @@ -139,7 +139,7 @@ public void FastForestRegressionIntrospectiveTraining() Assert.Equal(0, tree.GetCategoricalCategoricalSplitFeatureRangeAt(0).Count); var samples = new double[] { 0.97468354430379744, 1.0, 0.97727272727272729, 0.972972972972973, 0.26124197002141325 }; - for (int i = 0; i < tree.NumLeaves; ++i) + for (int i = 0; i < tree.NumberOfLeaves; ++i) { var sample = tree.GetLeafSamplesAt(i); Assert.Single(sample); From 8d27bab3d9ae4d92d6c4b147ac14197e815b6d24 Mon Sep 17 00:00:00 2001 From: Wei-Sheng Chin Date: Fri, 1 Mar 2019 14:35:28 -0800 Subject: [PATCH 07/12] Address comments --- src/Microsoft.ML.FastTree/BoostingFastTree.cs | 14 ++++---- src/Microsoft.ML.FastTree/FastTree.cs | 26 +++++++-------- .../FastTreeArguments.cs | 3 +- .../FastTreeClassification.cs | 26 +++++++-------- src/Microsoft.ML.FastTree/FastTreeRanking.cs | 32 +++++++++---------- .../FastTreeRegression.cs | 26 +++++++-------- src/Microsoft.ML.FastTree/FastTreeTweedie.cs | 30 ++++++++--------- .../GamClassification.cs | 22 ++++++------- src/Microsoft.ML.FastTree/GamRegression.cs | 22 ++++++------- src/Microsoft.ML.FastTree/GamTrainer.cs | 20 ++++++------ src/Microsoft.ML.FastTree/RandomForest.cs | 14 ++++---- .../RandomForestClassification.cs | 30 ++++++++--------- .../RandomForestRegression.cs | 30 ++++++++--------- 13 files changed, 148 insertions(+), 147 deletions(-) diff --git a/src/Microsoft.ML.FastTree/BoostingFastTree.cs b/src/Microsoft.ML.FastTree/BoostingFastTree.cs index c98c96c548..e587dcb4c3 100644 --- a/src/Microsoft.ML.FastTree/BoostingFastTree.cs +++ b/src/Microsoft.ML.FastTree/BoostingFastTree.cs @@ -18,14 +18,14 @@ private protected BoostingFastTreeTrainerBase(IHostEnvironment env, TOptions opt private protected BoostingFastTreeTrainerBase(IHostEnvironment env, SchemaShape.Column label, - string featureColumn, - string weightColumn, - string groupIdColumn, - int numLeaves, - int numTrees, - int minDatapointsInLeaves, + string featureColumnName, + string exampleWeightColumnName, + string rowGroupColumnName, + int numberOfLeaves, + int numberOfTrees, + int minimumExampleCountPerLeaf, double learningRate) - : base(env, label, featureColumn, weightColumn, groupIdColumn, numLeaves, numTrees, minDatapointsInLeaves) + : base(env, label, featureColumnName, exampleWeightColumnName, rowGroupColumnName, numberOfLeaves, numberOfTrees, minimumExampleCountPerLeaf) { FastTreeTrainerOptions.LearningRate = learningRate; } diff --git a/src/Microsoft.ML.FastTree/FastTree.cs b/src/Microsoft.ML.FastTree/FastTree.cs index 01a58250c2..2814ca859a 100644 --- a/src/Microsoft.ML.FastTree/FastTree.cs +++ b/src/Microsoft.ML.FastTree/FastTree.cs @@ -101,26 +101,26 @@ public abstract class FastTreeTrainerBase : /// private protected FastTreeTrainerBase(IHostEnvironment env, SchemaShape.Column label, - string featureColumn, - string weightColumn, - string groupIdColumn, - int numLeaves, - int numTrees, - int minDatapointsInLeaves) - : base(Contracts.CheckRef(env, nameof(env)).Register(RegisterName), TrainerUtils.MakeR4VecFeature(featureColumn), label, TrainerUtils.MakeR4ScalarWeightColumn(weightColumn), TrainerUtils.MakeU4ScalarColumn(groupIdColumn)) + string featureColumnName, + string exampleWeightColumnName, + string rowGroupColumnName, + int numberOfLeaves, + int numberOfTrees, + int minimumExampleCountPerLeaf) + : base(Contracts.CheckRef(env, nameof(env)).Register(RegisterName), TrainerUtils.MakeR4VecFeature(featureColumnName), label, TrainerUtils.MakeR4ScalarWeightColumn(exampleWeightColumnName), TrainerUtils.MakeU4ScalarColumn(rowGroupColumnName)) { FastTreeTrainerOptions = new TOptions(); // set up the directly provided values // override with the directly provided values. - FastTreeTrainerOptions.NumberOfLeaves = numLeaves; - FastTreeTrainerOptions.NumberOfTrees = numTrees; - FastTreeTrainerOptions.MinimumExampleCountPerLeaf = minDatapointsInLeaves; + FastTreeTrainerOptions.NumberOfLeaves = numberOfLeaves; + FastTreeTrainerOptions.NumberOfTrees = numberOfTrees; + FastTreeTrainerOptions.MinimumExampleCountPerLeaf = minimumExampleCountPerLeaf; FastTreeTrainerOptions.LabelColumnName = label.Name; - FastTreeTrainerOptions.FeatureColumnName = featureColumn; - FastTreeTrainerOptions.ExampleWeightColumnName = weightColumn; - FastTreeTrainerOptions.RowGroupColumnName = groupIdColumn; + FastTreeTrainerOptions.FeatureColumnName = featureColumnName; + FastTreeTrainerOptions.ExampleWeightColumnName = exampleWeightColumnName; + FastTreeTrainerOptions.RowGroupColumnName = rowGroupColumnName; // The discretization step renders this trainer non-parametric, and therefore it does not need normalization. // Also since it builds its own internal discretized columnar structures, it cannot benefit from caching. diff --git a/src/Microsoft.ML.FastTree/FastTreeArguments.cs b/src/Microsoft.ML.FastTree/FastTreeArguments.cs index 9b57f53979..d2872d2910 100644 --- a/src/Microsoft.ML.FastTree/FastTreeArguments.cs +++ b/src/Microsoft.ML.FastTree/FastTreeArguments.cs @@ -375,9 +375,10 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// /// The level of feature compression to use. /// + [BestFriend] [Argument(ArgumentType.LastOccurenceWins, HelpText = "The level of feature compression to use", ShortName = "fcomp", Hide = true)] [TGUI(NotGui = true)] - public int FeatureCompressionLevel = 1; + internal int FeatureCompressionLevel = 1; /// /// Compress the tree Ensemble. diff --git a/src/Microsoft.ML.FastTree/FastTreeClassification.cs b/src/Microsoft.ML.FastTree/FastTreeClassification.cs index e22f84141a..c7a54428f7 100644 --- a/src/Microsoft.ML.FastTree/FastTreeClassification.cs +++ b/src/Microsoft.ML.FastTree/FastTreeClassification.cs @@ -118,22 +118,22 @@ public sealed partial class FastTreeBinaryClassificationTrainer : /// Initializes a new instance of /// /// The private instance of . - /// The name of the label column. - /// The name of the feature column. - /// The name for the column containing the initial weight. + /// The name of the label column. + /// The name of the feature column. + /// The name for the column containing the example weight. /// The learning rate. - /// The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data. - /// The max number of leaves in each regression tree. - /// Total number of decision trees to create in the ensemble. + /// The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data. + /// The max number of leaves in each regression tree. + /// Total number of decision trees to create in the ensemble. internal FastTreeBinaryClassificationTrainer(IHostEnvironment env, - string labelColumn = DefaultColumnNames.Label, - string featureColumn = DefaultColumnNames.Features, - string weightColumn = null, - int numLeaves = Defaults.NumberOfLeaves, - int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, + string labelColumnName = DefaultColumnNames.Label, + string featureColumnName = DefaultColumnNames.Features, + string exampleWeightColumnName = null, + int numberOfLeaves = Defaults.NumberOfLeaves, + int numberOfTrees = Defaults.NumberOfTrees, + int minimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate) - : base(env, TrainerUtils.MakeBoolScalarLabel(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves, learningRate) + : base(env, TrainerUtils.MakeBoolScalarLabel(labelColumnName), featureColumnName, exampleWeightColumnName, null, numberOfLeaves, numberOfTrees, minimumExampleCountPerLeaf, learningRate) { // Set the sigmoid parameter to the 2 * learning rate, for traditional FastTreeClassification loss _sigmoidParameter = 2.0 * FastTreeTrainerOptions.LearningRate; diff --git a/src/Microsoft.ML.FastTree/FastTreeRanking.cs b/src/Microsoft.ML.FastTree/FastTreeRanking.cs index a0bcff770c..a40d5a7ef0 100644 --- a/src/Microsoft.ML.FastTree/FastTreeRanking.cs +++ b/src/Microsoft.ML.FastTree/FastTreeRanking.cs @@ -60,26 +60,26 @@ public sealed partial class FastTreeRankingTrainer /// Initializes a new instance of /// /// The private instance of . - /// The name of the label column. - /// The name of the feature column. - /// The name for the column containing the group ID. - /// The name for the column containing the initial weight. - /// The max number of leaves in each regression tree. - /// Total number of decision trees to create in the ensemble. - /// The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data. + /// The name of the label column. + /// The name of the feature column. + /// The name for the column containing the group ID. + /// The name for the column containing the examle weight. + /// The max number of leaves in each regression tree. + /// Total number of decision trees to create in the ensemble. + /// The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data. /// The learning rate. internal FastTreeRankingTrainer(IHostEnvironment env, - string labelColumn = DefaultColumnNames.Label, - string featureColumn = DefaultColumnNames.Features, - string groupIdColumn = DefaultColumnNames.GroupId, - string weightColumn = null, - int numLeaves = Defaults.NumberOfLeaves, - int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, + string labelColumnName = DefaultColumnNames.Label, + string featureColumnName = DefaultColumnNames.Features, + string rowGroupColumnName = DefaultColumnNames.GroupId, + string exampleWeightColumnName = null, + int numberOfLeaves = Defaults.NumberOfLeaves, + int numberOfTrees = Defaults.NumberOfTrees, + int minimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate) - : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, groupIdColumn, numLeaves, numTrees, minDatapointsInLeaves, learningRate) + : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumnName), featureColumnName, exampleWeightColumnName, rowGroupColumnName, numberOfLeaves, numberOfTrees, minimumExampleCountPerLeaf, learningRate) { - Host.CheckNonEmpty(groupIdColumn, nameof(groupIdColumn)); + Host.CheckNonEmpty(rowGroupColumnName, nameof(rowGroupColumnName)); } /// diff --git a/src/Microsoft.ML.FastTree/FastTreeRegression.cs b/src/Microsoft.ML.FastTree/FastTreeRegression.cs index be868e65b0..ac7ca46fbc 100644 --- a/src/Microsoft.ML.FastTree/FastTreeRegression.cs +++ b/src/Microsoft.ML.FastTree/FastTreeRegression.cs @@ -51,22 +51,22 @@ public sealed partial class FastTreeRegressionTrainer /// Initializes a new instance of /// /// The private instance of . - /// The name of the label column. - /// The name of the feature column. - /// The name for the column containing the initial weight. + /// The name of the label column. + /// The name of the feature column. + /// The name for the column containing the example weight. /// The learning rate. - /// The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data. - /// The max number of leaves in each regression tree. - /// Total number of decision trees to create in the ensemble. + /// The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data. + /// The max number of leaves in each regression tree. + /// Total number of decision trees to create in the ensemble. internal FastTreeRegressionTrainer(IHostEnvironment env, - string labelColumn = DefaultColumnNames.Label, - string featureColumn = DefaultColumnNames.Features, - string weightColumn = null, - int numLeaves = Defaults.NumberOfLeaves, - int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, + string labelColumnName = DefaultColumnNames.Label, + string featureColumnName = DefaultColumnNames.Features, + string exampleWeightColumnName = null, + int numberOfLeaves = Defaults.NumberOfLeaves, + int numberOfTrees = Defaults.NumberOfTrees, + int minimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate) - : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves, learningRate) + : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumnName), featureColumnName, exampleWeightColumnName, null, numberOfLeaves, numberOfTrees, minimumExampleCountPerLeaf, learningRate) { } diff --git a/src/Microsoft.ML.FastTree/FastTreeTweedie.cs b/src/Microsoft.ML.FastTree/FastTreeTweedie.cs index 6f31295d75..58510cec75 100644 --- a/src/Microsoft.ML.FastTree/FastTreeTweedie.cs +++ b/src/Microsoft.ML.FastTree/FastTreeTweedie.cs @@ -49,25 +49,25 @@ public sealed partial class FastTreeTweedieTrainer /// Initializes a new instance of /// /// The private instance of . - /// The name of the label column. - /// The name of the feature column. - /// The name for the column containing the initial weight. + /// The name of the label column. + /// The name of the feature column. + /// The name for the column containing the example weight. /// The learning rate. - /// The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data. - /// The max number of leaves in each regression tree. - /// Total number of decision trees to create in the ensemble. + /// The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data. + /// The max number of leaves in each regression tree. + /// Total number of decision trees to create in the ensemble. internal FastTreeTweedieTrainer(IHostEnvironment env, - string labelColumn = DefaultColumnNames.Label, - string featureColumn = DefaultColumnNames.Features, - string weightColumn = null, - int numLeaves = Defaults.NumberOfLeaves, - int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf, + string labelColumnName = DefaultColumnNames.Label, + string featureColumnName = DefaultColumnNames.Features, + string exampleWeightColumnName = null, + int numberOfLeaves = Defaults.NumberOfLeaves, + int numberOfTrees = Defaults.NumberOfTrees, + int minimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf, double learningRate = Defaults.LearningRate) - : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves, learningRate) + : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumnName), featureColumnName, exampleWeightColumnName, null, numberOfLeaves, numberOfTrees, minimumExampleCountPerLeaf, learningRate) { - Host.CheckNonEmpty(labelColumn, nameof(labelColumn)); - Host.CheckNonEmpty(featureColumn, nameof(featureColumn)); + Host.CheckNonEmpty(labelColumnName, nameof(labelColumnName)); + Host.CheckNonEmpty(featureColumnName, nameof(featureColumnName)); Initialize(); } diff --git a/src/Microsoft.ML.FastTree/GamClassification.cs b/src/Microsoft.ML.FastTree/GamClassification.cs index eb28919742..980c6916a5 100644 --- a/src/Microsoft.ML.FastTree/GamClassification.cs +++ b/src/Microsoft.ML.FastTree/GamClassification.cs @@ -59,20 +59,20 @@ internal BinaryClassificationGamTrainer(IHostEnvironment env, Options options) /// Initializes a new instance of /// /// The private instance of . - /// The name of the label column. - /// The name of the feature column. - /// The name for the column containing the initial weight. - /// The number of iterations to use in learning the features. + /// The name of the label column. + /// The name of the feature column. + /// The name for the column containing the example weight. + /// The number of iterations to use in learning the features. /// The learning rate. GAMs work best with a small learning rate. - /// The maximum number of bins to use to approximate features + /// The maximum number of bins to use to approximate features internal BinaryClassificationGamTrainer(IHostEnvironment env, - string labelColumn = DefaultColumnNames.Label, - string featureColumn = DefaultColumnNames.Features, - string weightColumn = null, - int numIterations = GamDefaults.NumberOfIterations, + string labelColumnName = DefaultColumnNames.Label, + string featureColumnName = DefaultColumnNames.Features, + string rowGroupColumnName = null, + int numberOfIterations = GamDefaults.NumberOfIterations, double learningRate = GamDefaults.LearningRate, - int maxBins = GamDefaults.MaximumBinCountPerFeature) - : base(env, LoadNameValue, TrainerUtils.MakeBoolScalarLabel(labelColumn), featureColumn, weightColumn, numIterations, learningRate, maxBins) + int maximumBinCountPerFeature = GamDefaults.MaximumBinCountPerFeature) + : base(env, LoadNameValue, TrainerUtils.MakeBoolScalarLabel(labelColumnName), featureColumnName, rowGroupColumnName, numberOfIterations, learningRate, maximumBinCountPerFeature) { _sigmoidParameter = 1; } diff --git a/src/Microsoft.ML.FastTree/GamRegression.cs b/src/Microsoft.ML.FastTree/GamRegression.cs index b3eac9b401..ca0b127bf3 100644 --- a/src/Microsoft.ML.FastTree/GamRegression.cs +++ b/src/Microsoft.ML.FastTree/GamRegression.cs @@ -45,20 +45,20 @@ internal RegressionGamTrainer(IHostEnvironment env, Options options) /// Initializes a new instance of /// /// The private instance of . - /// The name of the label column. - /// The name of the feature column. - /// The name for the column containing the initial weight. - /// The number of iterations to use in learning the features. + /// The name of the label column. + /// The name of the feature column. + /// The name for the column containing the example weight. + /// The number of iterations to use in learning the features. /// The learning rate. GAMs work best with a small learning rate. - /// The maximum number of bins to use to approximate features + /// The maximum number of bins to use to approximate features internal RegressionGamTrainer(IHostEnvironment env, - string labelColumn = DefaultColumnNames.Label, - string featureColumn = DefaultColumnNames.Features, - string weightColumn = null, - int numIterations = GamDefaults.NumberOfIterations, + string labelColumnName = DefaultColumnNames.Label, + string featureColumnName = DefaultColumnNames.Features, + string rowGroupColumnName = null, + int numberOfIterations = GamDefaults.NumberOfIterations, double learningRate = GamDefaults.LearningRate, - int maxBins = GamDefaults.MaximumBinCountPerFeature) - : base(env, LoadNameValue, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, numIterations, learningRate, maxBins) + int maximumBinCountPerFeature = GamDefaults.MaximumBinCountPerFeature) + : base(env, LoadNameValue, TrainerUtils.MakeR4ScalarColumn(labelColumnName), featureColumnName, rowGroupColumnName, numberOfIterations, learningRate, maximumBinCountPerFeature) { } diff --git a/src/Microsoft.ML.FastTree/GamTrainer.cs b/src/Microsoft.ML.FastTree/GamTrainer.cs index 34f5b7e24f..f4c3a530e6 100644 --- a/src/Microsoft.ML.FastTree/GamTrainer.cs +++ b/src/Microsoft.ML.FastTree/GamTrainer.cs @@ -148,23 +148,23 @@ public abstract class OptionsBase : TrainerInputBaseWithWeight private protected GamTrainerBase(IHostEnvironment env, string name, SchemaShape.Column label, - string featureColumn, - string weightColumn, - int numIterations, + string featureColumnName, + string weightCrowGroupColumnName, + int numberOfIterations, double learningRate, - int maxBins) - : base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(featureColumn), label, TrainerUtils.MakeR4ScalarWeightColumn(weightColumn)) + int maximumBinCountPerFeature) + : base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(featureColumnName), label, TrainerUtils.MakeR4ScalarWeightColumn(weightCrowGroupColumnName)) { GamTrainerOptions = new TOptions(); - GamTrainerOptions.NumberOfIterations = numIterations; + GamTrainerOptions.NumberOfIterations = numberOfIterations; GamTrainerOptions.LearningRate = learningRate; - GamTrainerOptions.MaximumBinCountPerFeature = maxBins; + GamTrainerOptions.MaximumBinCountPerFeature = maximumBinCountPerFeature; GamTrainerOptions.LabelColumnName = label.Name; - GamTrainerOptions.FeatureColumnName = featureColumn; + GamTrainerOptions.FeatureColumnName = featureColumnName; - if (weightColumn != null) - GamTrainerOptions.ExampleWeightColumnName = weightColumn; + if (weightCrowGroupColumnName != null) + GamTrainerOptions.ExampleWeightColumnName = weightCrowGroupColumnName; Info = new TrainerInfo(normalization: false, calibration: NeedCalibration, caching: false, supportValid: true); _gainConfidenceInSquaredStandardDeviations = Math.Pow(ProbabilityFunctions.Probit(1 - (1 - GamTrainerOptions.GainConfidenceLevel) * 0.5), 2); diff --git a/src/Microsoft.ML.FastTree/RandomForest.cs b/src/Microsoft.ML.FastTree/RandomForest.cs index efeebcb1ec..488f4eee5f 100644 --- a/src/Microsoft.ML.FastTree/RandomForest.cs +++ b/src/Microsoft.ML.FastTree/RandomForest.cs @@ -25,14 +25,14 @@ private protected RandomForestTrainerBase(IHostEnvironment env, TOptions options /// private protected RandomForestTrainerBase(IHostEnvironment env, SchemaShape.Column label, - string featureColumn, - string weightColumn, - string groupIdColumn, - int numLeaves, - int numTrees, - int minDatapointsInLeaves, + string featureColumnName, + string exampleWeightColumnName, + string rowGroupColumnName, + int numberOfLeaves, + int numberOfTrees, + int minimumExampleCountPerLeaf, bool quantileEnabled = false) - : base(env, label, featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves) + : base(env, label, featureColumnName, exampleWeightColumnName, null, numberOfLeaves, numberOfTrees, minimumExampleCountPerLeaf) { _quantileEnabled = quantileEnabled; } diff --git a/src/Microsoft.ML.FastTree/RandomForestClassification.cs b/src/Microsoft.ML.FastTree/RandomForestClassification.cs index 3a17f1f47e..d6b4106a4e 100644 --- a/src/Microsoft.ML.FastTree/RandomForestClassification.cs +++ b/src/Microsoft.ML.FastTree/RandomForestClassification.cs @@ -134,23 +134,23 @@ public sealed class Options : FastForestOptionsBase /// Initializes a new instance of /// /// The private instance of . - /// The name of the label column. - /// The name of the feature column. - /// The name for the column containing the initial weight. - /// The max number of leaves in each regression tree. - /// Total number of decision trees to create in the ensemble. - /// The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data. + /// The name of the label column. + /// The name of the feature column. + /// The name for the column containing the example weight. + /// The max number of leaves in each regression tree. + /// Total number of decision trees to create in the ensemble. + /// The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data. internal FastForestClassification(IHostEnvironment env, - string labelColumn = DefaultColumnNames.Label, - string featureColumn = DefaultColumnNames.Features, - string weightColumn = null, - int numLeaves = Defaults.NumberOfLeaves, - int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf) - : base(env, TrainerUtils.MakeBoolScalarLabel(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves) + string labelColumnName = DefaultColumnNames.Label, + string featureColumnName = DefaultColumnNames.Features, + string exampleWeightColumnName = null, + int numberOfLeaves = Defaults.NumberOfLeaves, + int numberOfTrees = Defaults.NumberOfTrees, + int minimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf) + : base(env, TrainerUtils.MakeBoolScalarLabel(labelColumnName), featureColumnName, exampleWeightColumnName, null, numberOfLeaves, numberOfTrees, minimumExampleCountPerLeaf) { - Host.CheckNonEmpty(labelColumn, nameof(labelColumn)); - Host.CheckNonEmpty(featureColumn, nameof(featureColumn)); + Host.CheckNonEmpty(labelColumnName, nameof(labelColumnName)); + Host.CheckNonEmpty(featureColumnName, nameof(featureColumnName)); } /// diff --git a/src/Microsoft.ML.FastTree/RandomForestRegression.cs b/src/Microsoft.ML.FastTree/RandomForestRegression.cs index bf999f1134..3eee18666c 100644 --- a/src/Microsoft.ML.FastTree/RandomForestRegression.cs +++ b/src/Microsoft.ML.FastTree/RandomForestRegression.cs @@ -263,23 +263,23 @@ public sealed class Options : FastForestOptionsBase /// Initializes a new instance of /// /// The private instance of . - /// The name of the label column. - /// The name of the feature column. - /// The optional name for the column containing the initial weight. - /// The max number of leaves in each regression tree. - /// Total number of decision trees to create in the ensemble. - /// The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data. + /// The name of the label column. + /// The name of the feature column. + /// The optional name for the column containing the example weight. + /// The max number of leaves in each regression tree. + /// Total number of decision trees to create in the ensemble. + /// The minimal number of documents allowed in a leaf of a regression tree, out of the subsampled data. internal FastForestRegression(IHostEnvironment env, - string labelColumn = DefaultColumnNames.Label, - string featureColumn = DefaultColumnNames.Features, - string weightColumn = null, - int numLeaves = Defaults.NumberOfLeaves, - int numTrees = Defaults.NumberOfTrees, - int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf) - : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves) + string labelColumnName = DefaultColumnNames.Label, + string featureColumnName = DefaultColumnNames.Features, + string exampleWeightColumnName = null, + int numberOfLeaves = Defaults.NumberOfLeaves, + int numberOfTrees = Defaults.NumberOfTrees, + int minimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf) + : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumnName), featureColumnName, exampleWeightColumnName, null, numberOfLeaves, numberOfTrees, minimumExampleCountPerLeaf) { - Host.CheckNonEmpty(labelColumn, nameof(labelColumn)); - Host.CheckNonEmpty(featureColumn, nameof(featureColumn)); + Host.CheckNonEmpty(labelColumnName, nameof(labelColumnName)); + Host.CheckNonEmpty(featureColumnName, nameof(featureColumnName)); } /// From dd3c8a20ccfc17cf9bcea12a8325d7f9560048e2 Mon Sep 17 00:00:00 2001 From: Wei-Sheng Chin Date: Fri, 1 Mar 2019 16:28:09 -0800 Subject: [PATCH 08/12] Remove extra short names for entry point BC --- .../FastTreeArguments.cs | 38 +- src/Microsoft.ML.FastTree/GamTrainer.cs | 14 +- .../RandomForestClassification.cs | 4 +- .../Common/EntryPoints/core_manifest.json | 597 ++++++------------ .../UnitTests/TestEntryPoints.cs | 40 +- .../TestCommandBase.cs | 2 +- test/Microsoft.ML.Tests/OnnxConversionTest.cs | 2 +- 7 files changed, 249 insertions(+), 448 deletions(-) diff --git a/src/Microsoft.ML.FastTree/FastTreeArguments.cs b/src/Microsoft.ML.FastTree/FastTreeArguments.cs index d2872d2910..0f43b7ea33 100644 --- a/src/Microsoft.ML.FastTree/FastTreeArguments.cs +++ b/src/Microsoft.ML.FastTree/FastTreeArguments.cs @@ -161,7 +161,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// /// The number of threads to use. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The number of threads to use", ShortName = "t,NumThreads", NullName = "")] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The number of threads to use", ShortName = "t", NullName = "")] public int? NumberOfThreads = null; // this random seed is used for: @@ -174,14 +174,14 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// /// The seed of the random number generator. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The seed of the random number generator", ShortName = "r1,RngSeed")] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The seed of the random number generator", ShortName = "r1")] public int Seed = 123; // this random seed is only for active feature selection /// /// The seed of the active feature selection. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The seed of the active feature selection", ShortName = "r3,FeatureSelectSeed", Hide = true)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The seed of the active feature selection", ShortName = "r3", Hide = true)] [TGUI(NotGui = true)] public int FeatureSelectionSeed = 123; @@ -221,25 +221,25 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum categorical split groups to consider when splitting on a categorical feature. " + "Split groups are a collection of split points. This is used to reduce overfitting when " + - "there many categorical features.", ShortName = "mcg,MaxCategoricalGroupsPerNode")] + "there many categorical features.", ShortName = "mcg")] public int MaximumCategoricalGroupCountPerNode = 64; /// /// Maximum categorical split points to consider when splitting on a categorical feature. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum categorical split points to consider when splitting on a categorical feature.", ShortName = "maxcat,MaxCategoricalSplitPoints")] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum categorical split points to consider when splitting on a categorical feature.", ShortName = "maxcat")] public int MaximumCategoricalSplitPointCount = 64; /// /// Minimum categorical example percentage in a bin to consider for a split. Default is 0.1% of all training examples. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum categorical example percentage in a bin to consider for a split.", ShortName = "mdop,MinDocsPercentageForCategoricalSplit")] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum categorical example percentage in a bin to consider for a split.", ShortName = "mdop")] public double MinimumExampleFractionForCategoricalSplit = 0.001; /// /// Minimum categorical example count in a bin to consider for a split. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum categorical example count in a bin to consider for a split.", ShortName = "mdo,MinDocsForCategoricalSplit")] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum categorical example count in a bin to consider for a split.", ShortName = "mdo")] public int MinimumExamplesForCategoricalSplit = 100; /// @@ -262,7 +262,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// /// Maximum number of distinct values (bins) per feature. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum number of distinct values (bins) per feature", ShortName = "mb,MaxBins")] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum number of distinct values (bins) per feature", ShortName = "mb")] public int MaximumBinCountPerFeature = 255; // save one for undefs /// @@ -300,14 +300,14 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// /// Print execution time breakdown to ML.NET channel. /// - [Argument(ArgumentType.AtMostOnce, HelpText = "Print execution time breakdown to stdout", ShortName = "et,ExecutionTimes")] + [Argument(ArgumentType.AtMostOnce, HelpText = "Print execution time breakdown to stdout", ShortName = "et")] public bool ExecutionTime; // REVIEW: Different from original FastRank arguments (shortname l vs. nl). Different default from TLC FR Wrapper (20 vs. 20). /// /// The max number of leaves in each regression tree. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The max number of leaves in each regression tree", ShortName = "nl,NumLeaves", SortOrder = 2)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The max number of leaves in each regression tree", ShortName = "nl", SortOrder = 2)] [TGUI(Description = "The maximum number of leaves per tree", SuggestedSweeps = "2-128;log;inc:4")] [TlcModule.SweepableLongParamAttribute("NumLeaves", 2, 128, isLogScale: true, stepSize: 4)] public int NumberOfLeaves = Defaults.NumberOfLeaves; @@ -317,7 +317,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// // REVIEW: Arrays not supported in GUI // REVIEW: Different shortname than FastRank module. Same as the TLC FRWrapper. - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", ShortName = "mil,MinDocumentsInLeafs", SortOrder = 3)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", ShortName = "mil", SortOrder = 3)] [TGUI(Description = "Minimum number of training instances required to form a leaf", SuggestedSweeps = "1,10,50")] [TlcModule.SweepableDiscreteParamAttribute("MinDocumentsInLeafs", new object[] { 1, 10, 50 })] public int MinimumExampleCountPerLeaf = Defaults.MinimumExampleCountPerLeaf; @@ -326,7 +326,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// Total number of decision trees to create in the ensemble. /// // REVIEW: Different shortname than FastRank module. Same as the TLC FRWrapper. - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Total number of decision trees to create in the ensemble", ShortName = "iter,NumTrees", SortOrder = 1)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Total number of decision trees to create in the ensemble", ShortName = "iter", SortOrder = 1)] [TGUI(Description = "Total number of trees constructed", SuggestedSweeps = "20,100,500")] [TlcModule.SweepableDiscreteParamAttribute("NumTrees", new object[] { 20, 100, 500 })] public int NumberOfTrees = Defaults.NumberOfTrees; @@ -346,7 +346,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// /// Percentage of training examples used in each bag. Default is 0.7 (70%). /// - [Argument(ArgumentType.AtMostOnce, HelpText = "Percentage of training examples used in each bag", ShortName = "bagfrac,BaggingTrainFraction")] + [Argument(ArgumentType.AtMostOnce, HelpText = "Percentage of training examples used in each bag", ShortName = "bagfrac")] // REVIEW: sweeping bagfrac doesn't make sense unless 'baggingSize' is non-zero. The 'SuggestedSweeps' here // are used to denote 'sensible range', but the GUI will interpret this as 'you must sweep these values'. So, I'm keeping // the values there for the future, when we have an appropriate way to encode this information. @@ -356,7 +356,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// /// The fraction of features (chosen randomly) to use on each split. If it's value is 0.9, 90% of all features would be dropped in expectation. /// - [Argument(ArgumentType.AtMostOnce, HelpText = "The fraction of features (chosen randomly) to use on each split", ShortName = "sf,SplitFraction")] + [Argument(ArgumentType.AtMostOnce, HelpText = "The fraction of features (chosen randomly) to use on each split", ShortName = "sf")] public Double FeatureFractionPerSplit = 1; /// @@ -391,7 +391,7 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId /// Maximum Number of trees after compression. /// // REVIEW: Not used. - [Argument(ArgumentType.AtMostOnce, HelpText = "Maximum Number of trees after compression", ShortName = "cmpmax,MaxTreesAfterCompression", Hide = true)] + [Argument(ArgumentType.AtMostOnce, HelpText = "Maximum Number of trees after compression", ShortName = "cmpmax", Hide = true)] [TGUI(NotGui = true)] public int MaximumTreeCountAfterCompression = -1; @@ -465,13 +465,13 @@ public abstract class BoostedTreeOptions : TreeOptions /// /// Number of post-bracket line search steps. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Number of post-bracket line search steps", ShortName = "lssteps,NumPostBracketSteps")] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Number of post-bracket line search steps", ShortName = "lssteps")] public int MaximumNumberOfLineSearchSteps; /// /// Minimum line search step size. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum line search step size", ShortName = "minstep,MinStepSize")] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum line search step size", ShortName = "minstep")] public Double MinimumStepSize; public enum OptimizationAlgorithmType { GradientDescent, AcceleratedGradientDescent, ConjugateGradientDescent }; @@ -525,7 +525,7 @@ public enum OptimizationAlgorithmType { GradientDescent, AcceleratedGradientDesc /// /// The learning rate. /// - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The learning rate", ShortName = "lr,LearningRates", SortOrder = 4)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The learning rate", ShortName = "lr", SortOrder = 4)] [TGUI(Label = "Learning Rate", SuggestedSweeps = "0.025-0.4;log")] [TlcModule.SweepableFloatParamAttribute("LearningRates", 0.025f, 0.4f, isLogScale: true)] public double LearningRate = Defaults.LearningRate; @@ -561,7 +561,7 @@ public enum OptimizationAlgorithmType { GradientDescent, AcceleratedGradientDesc /// /// Upper bound on absolute value of single tree output. /// - [Argument(ArgumentType.AtMostOnce, HelpText = "Upper bound on absolute value of single tree output", ShortName = "mo,MaxTreeOutput")] + [Argument(ArgumentType.AtMostOnce, HelpText = "Upper bound on absolute value of single tree output", ShortName = "mo")] public Double MaximumTreeOutput = 100; /// diff --git a/src/Microsoft.ML.FastTree/GamTrainer.cs b/src/Microsoft.ML.FastTree/GamTrainer.cs index f4c3a530e6..23c273422f 100644 --- a/src/Microsoft.ML.FastTree/GamTrainer.cs +++ b/src/Microsoft.ML.FastTree/GamTrainer.cs @@ -63,15 +63,15 @@ public abstract class OptionsBase : TrainerInputBaseWithWeight [Argument(ArgumentType.LastOccurenceWins, HelpText = "Tree fitting gain confidence requirement (should be in the range [0,1) ).", ShortName = "gainconf")] public int GainConfidenceLevel; - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Total number of iterations over all features", ShortName = "iter,NumIterations", SortOrder = 1)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Total number of iterations over all features", ShortName = "iter", SortOrder = 1)] [TGUI(SuggestedSweeps = "200,1500,9500")] [TlcModule.SweepableDiscreteParamAttribute("NumIterations", new object[] { 200, 1500, 9500 })] public int NumberOfIterations = GamDefaults.NumberOfIterations; - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The number of threads to use", ShortName = "t,NumThreads", NullName = "")] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The number of threads to use", ShortName = "t", NullName = "")] public int? NumberOfThreads = null; - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The learning rate", ShortName = "lr,LearningRates", SortOrder = 4)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The learning rate", ShortName = "lr", SortOrder = 4)] [TGUI(SuggestedSweeps = "0.001,0.1;log")] [TlcModule.SweepableFloatParamAttribute("LearningRates", 0.001f, 0.1f, isLogScale: true)] public double LearningRate = GamDefaults.LearningRate; @@ -79,19 +79,19 @@ public abstract class OptionsBase : TrainerInputBaseWithWeight [Argument(ArgumentType.LastOccurenceWins, HelpText = "Whether to utilize the disk or the data's native transposition facilities (where applicable) when performing the transpose", ShortName = "dt")] public bool? DiskTranspose; - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum number of distinct values (bins) per feature", ShortName = "mb,MaxBins")] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Maximum number of distinct values (bins) per feature", ShortName = "mb")] public int MaximumBinCountPerFeature = GamDefaults.MaximumBinCountPerFeature; - [Argument(ArgumentType.AtMostOnce, HelpText = "Upper bound on absolute value of single output", ShortName = "mo,MaxOutput")] + [Argument(ArgumentType.AtMostOnce, HelpText = "Upper bound on absolute value of single output", ShortName = "mo")] public double MaximumTreeOutput = double.PositiveInfinity; [Argument(ArgumentType.AtMostOnce, HelpText = "Sample each query 1 in k times in the GetDerivatives function", ShortName = "sr")] public int GetDerivativesSampleRate = 1; - [Argument(ArgumentType.LastOccurenceWins, HelpText = "The seed of the random number generator", ShortName = "r1,RngSeed")] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "The seed of the random number generator", ShortName = "r1")] public int Seed = 123; - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum number of training instances required to form a partition", ShortName = "mi,MinDocuments", SortOrder = 3)] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Minimum number of training instances required to form a partition", ShortName = "mi", SortOrder = 3)] [TGUI(SuggestedSweeps = "1,10,50")] [TlcModule.SweepableDiscreteParamAttribute("MinDocuments", new object[] { 1, 10, 50 })] public int MinimumExampleCountPerLeaf = 10; diff --git a/src/Microsoft.ML.FastTree/RandomForestClassification.cs b/src/Microsoft.ML.FastTree/RandomForestClassification.cs index d6b4106a4e..bde7bf5052 100644 --- a/src/Microsoft.ML.FastTree/RandomForestClassification.cs +++ b/src/Microsoft.ML.FastTree/RandomForestClassification.cs @@ -31,7 +31,7 @@ namespace Microsoft.ML.Trainers.FastTree { public abstract class FastForestOptionsBase : TreeOptions { - [Argument(ArgumentType.AtMostOnce, HelpText = "Number of labels to be sampled from each leaf to make the distribtuion", ShortName = "qsc,QuantileSampleCount")] + [Argument(ArgumentType.AtMostOnce, HelpText = "Number of labels to be sampled from each leaf to make the distribtuion", ShortName = "qsc")] public int NumberOfQuantileSamples = 100; public FastForestOptionsBase() @@ -110,7 +110,7 @@ public sealed partial class FastForestClassification : { public sealed class Options : FastForestOptionsBase { - [Argument(ArgumentType.AtMostOnce, HelpText = "Upper bound on absolute value of single tree output", ShortName = "mo,MaxTreeOutput")] + [Argument(ArgumentType.AtMostOnce, HelpText = "Upper bound on absolute value of single tree output", ShortName = "mo")] public Double MaximumOutputMagnitudePerTree = 100; [Argument(ArgumentType.AtMostOnce, HelpText = "The calibrator kind to apply to the predictor. Specify null for no calibration", Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] diff --git a/test/BaselineOutput/Common/EntryPoints/core_manifest.json b/test/BaselineOutput/Common/EntryPoints/core_manifest.json index 8940a4b992..4b4fe9929b 100644 --- a/test/BaselineOutput/Common/EntryPoints/core_manifest.json +++ b/test/BaselineOutput/Common/EntryPoints/core_manifest.json @@ -5098,8 +5098,7 @@ "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter", - "NumTrees" + "iter" ], "Required": false, "SortOrder": 1.0, @@ -5130,8 +5129,7 @@ "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl", - "NumLeaves" + "nl" ], "Required": false, "SortOrder": 2.0, @@ -5162,8 +5160,7 @@ "Type": "Int", "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil", - "MinDocumentsInLeafs" + "mil" ], "Required": false, "SortOrder": 3.0, @@ -5258,8 +5255,7 @@ "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo", - "MaxTreeOutput" + "mo" ], "Required": false, "SortOrder": 150.0, @@ -5294,8 +5290,7 @@ "Type": "Int", "Desc": "Number of labels to be sampled from each leaf to make the distribtuion", "Aliases": [ - "qsc", - "QuantileSampleCount" + "qsc" ], "Required": false, "SortOrder": 150.0, @@ -5324,8 +5319,7 @@ "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t", - "NumThreads" + "t" ], "Required": false, "SortOrder": 150.0, @@ -5337,8 +5331,7 @@ "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1", - "RngSeed" + "r1" ], "Required": false, "SortOrder": 150.0, @@ -5350,8 +5343,7 @@ "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3", - "FeatureSelectSeed" + "r3" ], "Required": false, "SortOrder": 150.0, @@ -5423,8 +5415,7 @@ "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg", - "MaxCategoricalGroupsPerNode" + "mcg" ], "Required": false, "SortOrder": 150.0, @@ -5436,8 +5427,7 @@ "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat", - "MaxCategoricalSplitPoints" + "maxcat" ], "Required": false, "SortOrder": 150.0, @@ -5449,8 +5439,7 @@ "Type": "Float", "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ - "mdop", - "MinDocsPercentageForCategoricalSplit" + "mdop" ], "Required": false, "SortOrder": 150.0, @@ -5462,8 +5451,7 @@ "Type": "Int", "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ - "mdo", - "MinDocsForCategoricalSplit" + "mdo" ], "Required": false, "SortOrder": 150.0, @@ -5506,8 +5494,7 @@ "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb", - "MaxBins" + "mb" ], "Required": false, "SortOrder": 150.0, @@ -5579,8 +5566,7 @@ "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et", - "ExecutionTimes" + "et" ], "Required": false, "SortOrder": 150.0, @@ -5616,8 +5602,7 @@ "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac", - "BaggingTrainFraction" + "bagfrac" ], "Required": false, "SortOrder": 150.0, @@ -5629,8 +5614,7 @@ "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf", - "SplitFraction" + "sf" ], "Required": false, "SortOrder": 150.0, @@ -5691,8 +5675,7 @@ "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax", - "MaxTreesAfterCompression" + "cmpmax" ], "Required": false, "SortOrder": 150.0, @@ -5765,8 +5748,7 @@ "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter", - "NumTrees" + "iter" ], "Required": false, "SortOrder": 1.0, @@ -5797,8 +5779,7 @@ "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl", - "NumLeaves" + "nl" ], "Required": false, "SortOrder": 2.0, @@ -5829,8 +5810,7 @@ "Type": "Int", "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil", - "MinDocumentsInLeafs" + "mil" ], "Required": false, "SortOrder": 3.0, @@ -5934,8 +5914,7 @@ "Type": "Int", "Desc": "Number of labels to be sampled from each leaf to make the distribtuion", "Aliases": [ - "qsc", - "QuantileSampleCount" + "qsc" ], "Required": false, "SortOrder": 150.0, @@ -5964,8 +5943,7 @@ "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t", - "NumThreads" + "t" ], "Required": false, "SortOrder": 150.0, @@ -5977,8 +5955,7 @@ "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1", - "RngSeed" + "r1" ], "Required": false, "SortOrder": 150.0, @@ -5990,8 +5967,7 @@ "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3", - "FeatureSelectSeed" + "r3" ], "Required": false, "SortOrder": 150.0, @@ -6063,8 +6039,7 @@ "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg", - "MaxCategoricalGroupsPerNode" + "mcg" ], "Required": false, "SortOrder": 150.0, @@ -6076,8 +6051,7 @@ "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat", - "MaxCategoricalSplitPoints" + "maxcat" ], "Required": false, "SortOrder": 150.0, @@ -6089,8 +6063,7 @@ "Type": "Float", "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ - "mdop", - "MinDocsPercentageForCategoricalSplit" + "mdop" ], "Required": false, "SortOrder": 150.0, @@ -6102,8 +6075,7 @@ "Type": "Int", "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ - "mdo", - "MinDocsForCategoricalSplit" + "mdo" ], "Required": false, "SortOrder": 150.0, @@ -6146,8 +6118,7 @@ "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb", - "MaxBins" + "mb" ], "Required": false, "SortOrder": 150.0, @@ -6219,8 +6190,7 @@ "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et", - "ExecutionTimes" + "et" ], "Required": false, "SortOrder": 150.0, @@ -6256,8 +6226,7 @@ "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac", - "BaggingTrainFraction" + "bagfrac" ], "Required": false, "SortOrder": 150.0, @@ -6269,8 +6238,7 @@ "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf", - "SplitFraction" + "sf" ], "Required": false, "SortOrder": 150.0, @@ -6331,8 +6299,7 @@ "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax", - "MaxTreesAfterCompression" + "cmpmax" ], "Required": false, "SortOrder": 150.0, @@ -6405,8 +6372,7 @@ "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter", - "NumTrees" + "iter" ], "Required": false, "SortOrder": 1.0, @@ -6437,8 +6403,7 @@ "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl", - "NumLeaves" + "nl" ], "Required": false, "SortOrder": 2.0, @@ -6469,8 +6434,7 @@ "Type": "Int", "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil", - "MinDocumentsInLeafs" + "mil" ], "Required": false, "SortOrder": 3.0, @@ -6502,8 +6466,7 @@ "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr", - "LearningRates" + "lr" ], "Required": false, "SortOrder": 4.0, @@ -6620,8 +6583,7 @@ "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps", - "NumPostBracketSteps" + "lssteps" ], "Required": false, "SortOrder": 150.0, @@ -6633,8 +6595,7 @@ "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep", - "MinStepSize" + "minstep" ], "Required": false, "SortOrder": 150.0, @@ -6804,8 +6765,7 @@ "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo", - "MaxTreeOutput" + "mo" ], "Required": false, "SortOrder": 150.0, @@ -6894,8 +6854,7 @@ "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t", - "NumThreads" + "t" ], "Required": false, "SortOrder": 150.0, @@ -6907,8 +6866,7 @@ "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1", - "RngSeed" + "r1" ], "Required": false, "SortOrder": 150.0, @@ -6920,8 +6878,7 @@ "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3", - "FeatureSelectSeed" + "r3" ], "Required": false, "SortOrder": 150.0, @@ -6993,8 +6950,7 @@ "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg", - "MaxCategoricalGroupsPerNode" + "mcg" ], "Required": false, "SortOrder": 150.0, @@ -7006,8 +6962,7 @@ "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat", - "MaxCategoricalSplitPoints" + "maxcat" ], "Required": false, "SortOrder": 150.0, @@ -7019,8 +6974,7 @@ "Type": "Float", "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ - "mdop", - "MinDocsPercentageForCategoricalSplit" + "mdop" ], "Required": false, "SortOrder": 150.0, @@ -7032,8 +6986,7 @@ "Type": "Int", "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ - "mdo", - "MinDocsForCategoricalSplit" + "mdo" ], "Required": false, "SortOrder": 150.0, @@ -7076,8 +7029,7 @@ "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb", - "MaxBins" + "mb" ], "Required": false, "SortOrder": 150.0, @@ -7149,8 +7101,7 @@ "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et", - "ExecutionTimes" + "et" ], "Required": false, "SortOrder": 150.0, @@ -7186,8 +7137,7 @@ "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac", - "BaggingTrainFraction" + "bagfrac" ], "Required": false, "SortOrder": 150.0, @@ -7199,8 +7149,7 @@ "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf", - "SplitFraction" + "sf" ], "Required": false, "SortOrder": 150.0, @@ -7261,8 +7210,7 @@ "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax", - "MaxTreesAfterCompression" + "cmpmax" ], "Required": false, "SortOrder": 150.0, @@ -7335,8 +7283,7 @@ "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter", - "NumTrees" + "iter" ], "Required": false, "SortOrder": 1.0, @@ -7367,8 +7314,7 @@ "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl", - "NumLeaves" + "nl" ], "Required": false, "SortOrder": 2.0, @@ -7399,8 +7345,7 @@ "Type": "Int", "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil", - "MinDocumentsInLeafs" + "mil" ], "Required": false, "SortOrder": 3.0, @@ -7432,8 +7377,7 @@ "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr", - "LearningRates" + "lr" ], "Required": false, "SortOrder": 4.0, @@ -7631,8 +7575,7 @@ "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps", - "NumPostBracketSteps" + "lssteps" ], "Required": false, "SortOrder": 150.0, @@ -7644,8 +7587,7 @@ "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep", - "MinStepSize" + "minstep" ], "Required": false, "SortOrder": 150.0, @@ -7815,8 +7757,7 @@ "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo", - "MaxTreeOutput" + "mo" ], "Required": false, "SortOrder": 150.0, @@ -7905,8 +7846,7 @@ "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t", - "NumThreads" + "t" ], "Required": false, "SortOrder": 150.0, @@ -7918,8 +7858,7 @@ "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1", - "RngSeed" + "r1" ], "Required": false, "SortOrder": 150.0, @@ -7931,8 +7870,7 @@ "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3", - "FeatureSelectSeed" + "r3" ], "Required": false, "SortOrder": 150.0, @@ -8004,8 +7942,7 @@ "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg", - "MaxCategoricalGroupsPerNode" + "mcg" ], "Required": false, "SortOrder": 150.0, @@ -8017,8 +7954,7 @@ "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat", - "MaxCategoricalSplitPoints" + "maxcat" ], "Required": false, "SortOrder": 150.0, @@ -8030,8 +7966,7 @@ "Type": "Float", "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ - "mdop", - "MinDocsPercentageForCategoricalSplit" + "mdop" ], "Required": false, "SortOrder": 150.0, @@ -8043,8 +7978,7 @@ "Type": "Int", "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ - "mdo", - "MinDocsForCategoricalSplit" + "mdo" ], "Required": false, "SortOrder": 150.0, @@ -8087,8 +8021,7 @@ "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb", - "MaxBins" + "mb" ], "Required": false, "SortOrder": 150.0, @@ -8160,8 +8093,7 @@ "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et", - "ExecutionTimes" + "et" ], "Required": false, "SortOrder": 150.0, @@ -8197,8 +8129,7 @@ "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac", - "BaggingTrainFraction" + "bagfrac" ], "Required": false, "SortOrder": 150.0, @@ -8210,8 +8141,7 @@ "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf", - "SplitFraction" + "sf" ], "Required": false, "SortOrder": 150.0, @@ -8272,8 +8202,7 @@ "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax", - "MaxTreesAfterCompression" + "cmpmax" ], "Required": false, "SortOrder": 150.0, @@ -8346,8 +8275,7 @@ "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter", - "NumTrees" + "iter" ], "Required": false, "SortOrder": 1.0, @@ -8378,8 +8306,7 @@ "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl", - "NumLeaves" + "nl" ], "Required": false, "SortOrder": 2.0, @@ -8410,8 +8337,7 @@ "Type": "Int", "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil", - "MinDocumentsInLeafs" + "mil" ], "Required": false, "SortOrder": 3.0, @@ -8443,8 +8369,7 @@ "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr", - "LearningRates" + "lr" ], "Required": false, "SortOrder": 4.0, @@ -8549,8 +8474,7 @@ "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps", - "NumPostBracketSteps" + "lssteps" ], "Required": false, "SortOrder": 150.0, @@ -8562,8 +8486,7 @@ "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep", - "MinStepSize" + "minstep" ], "Required": false, "SortOrder": 150.0, @@ -8733,8 +8656,7 @@ "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo", - "MaxTreeOutput" + "mo" ], "Required": false, "SortOrder": 150.0, @@ -8823,8 +8745,7 @@ "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t", - "NumThreads" + "t" ], "Required": false, "SortOrder": 150.0, @@ -8836,8 +8757,7 @@ "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1", - "RngSeed" + "r1" ], "Required": false, "SortOrder": 150.0, @@ -8849,8 +8769,7 @@ "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3", - "FeatureSelectSeed" + "r3" ], "Required": false, "SortOrder": 150.0, @@ -8922,8 +8841,7 @@ "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg", - "MaxCategoricalGroupsPerNode" + "mcg" ], "Required": false, "SortOrder": 150.0, @@ -8935,8 +8853,7 @@ "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat", - "MaxCategoricalSplitPoints" + "maxcat" ], "Required": false, "SortOrder": 150.0, @@ -8948,8 +8865,7 @@ "Type": "Float", "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ - "mdop", - "MinDocsPercentageForCategoricalSplit" + "mdop" ], "Required": false, "SortOrder": 150.0, @@ -8961,8 +8877,7 @@ "Type": "Int", "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ - "mdo", - "MinDocsForCategoricalSplit" + "mdo" ], "Required": false, "SortOrder": 150.0, @@ -9005,8 +8920,7 @@ "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb", - "MaxBins" + "mb" ], "Required": false, "SortOrder": 150.0, @@ -9078,8 +8992,7 @@ "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et", - "ExecutionTimes" + "et" ], "Required": false, "SortOrder": 150.0, @@ -9115,8 +9028,7 @@ "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac", - "BaggingTrainFraction" + "bagfrac" ], "Required": false, "SortOrder": 150.0, @@ -9128,8 +9040,7 @@ "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf", - "SplitFraction" + "sf" ], "Required": false, "SortOrder": 150.0, @@ -9190,8 +9101,7 @@ "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax", - "MaxTreesAfterCompression" + "cmpmax" ], "Required": false, "SortOrder": 150.0, @@ -9264,8 +9174,7 @@ "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter", - "NumTrees" + "iter" ], "Required": false, "SortOrder": 1.0, @@ -9296,8 +9205,7 @@ "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl", - "NumLeaves" + "nl" ], "Required": false, "SortOrder": 2.0, @@ -9328,8 +9236,7 @@ "Type": "Int", "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil", - "MinDocumentsInLeafs" + "mil" ], "Required": false, "SortOrder": 3.0, @@ -9361,8 +9268,7 @@ "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr", - "LearningRates" + "lr" ], "Required": false, "SortOrder": 4.0, @@ -9476,8 +9382,7 @@ "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps", - "NumPostBracketSteps" + "lssteps" ], "Required": false, "SortOrder": 150.0, @@ -9489,8 +9394,7 @@ "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep", - "MinStepSize" + "minstep" ], "Required": false, "SortOrder": 150.0, @@ -9660,8 +9564,7 @@ "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo", - "MaxTreeOutput" + "mo" ], "Required": false, "SortOrder": 150.0, @@ -9750,8 +9653,7 @@ "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t", - "NumThreads" + "t" ], "Required": false, "SortOrder": 150.0, @@ -9763,8 +9665,7 @@ "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1", - "RngSeed" + "r1" ], "Required": false, "SortOrder": 150.0, @@ -9776,8 +9677,7 @@ "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3", - "FeatureSelectSeed" + "r3" ], "Required": false, "SortOrder": 150.0, @@ -9849,8 +9749,7 @@ "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg", - "MaxCategoricalGroupsPerNode" + "mcg" ], "Required": false, "SortOrder": 150.0, @@ -9862,8 +9761,7 @@ "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat", - "MaxCategoricalSplitPoints" + "maxcat" ], "Required": false, "SortOrder": 150.0, @@ -9875,8 +9773,7 @@ "Type": "Float", "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ - "mdop", - "MinDocsPercentageForCategoricalSplit" + "mdop" ], "Required": false, "SortOrder": 150.0, @@ -9888,8 +9785,7 @@ "Type": "Int", "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ - "mdo", - "MinDocsForCategoricalSplit" + "mdo" ], "Required": false, "SortOrder": 150.0, @@ -9932,8 +9828,7 @@ "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb", - "MaxBins" + "mb" ], "Required": false, "SortOrder": 150.0, @@ -10005,8 +9900,7 @@ "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et", - "ExecutionTimes" + "et" ], "Required": false, "SortOrder": 150.0, @@ -10042,8 +9936,7 @@ "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac", - "BaggingTrainFraction" + "bagfrac" ], "Required": false, "SortOrder": 150.0, @@ -10055,8 +9948,7 @@ "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf", - "SplitFraction" + "sf" ], "Required": false, "SortOrder": 150.0, @@ -10117,8 +10009,7 @@ "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax", - "MaxTreesAfterCompression" + "cmpmax" ], "Required": false, "SortOrder": 150.0, @@ -10458,8 +10349,7 @@ "Type": "Int", "Desc": "Total number of iterations over all features", "Aliases": [ - "iter", - "NumIterations" + "iter" ], "Required": false, "SortOrder": 1.0, @@ -10502,8 +10392,7 @@ "Type": "Int", "Desc": "Minimum number of training instances required to form a partition", "Aliases": [ - "mi", - "MinDocuments" + "mi" ], "Required": false, "SortOrder": 3.0, @@ -10535,8 +10424,7 @@ "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr", - "LearningRates" + "lr" ], "Required": false, "SortOrder": 4.0, @@ -10641,8 +10529,7 @@ "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t", - "NumThreads" + "t" ], "Required": false, "SortOrder": 150.0, @@ -10666,8 +10553,7 @@ "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb", - "MaxBins" + "mb" ], "Required": false, "SortOrder": 150.0, @@ -10679,8 +10565,7 @@ "Type": "Float", "Desc": "Upper bound on absolute value of single output", "Aliases": [ - "mo", - "MaxOutput" + "mo" ], "Required": false, "SortOrder": 150.0, @@ -10704,8 +10589,7 @@ "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1", - "RngSeed" + "r1" ], "Required": false, "SortOrder": 150.0, @@ -10765,8 +10649,7 @@ "Type": "Int", "Desc": "Total number of iterations over all features", "Aliases": [ - "iter", - "NumIterations" + "iter" ], "Required": false, "SortOrder": 1.0, @@ -10809,8 +10692,7 @@ "Type": "Int", "Desc": "Minimum number of training instances required to form a partition", "Aliases": [ - "mi", - "MinDocuments" + "mi" ], "Required": false, "SortOrder": 3.0, @@ -10842,8 +10724,7 @@ "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr", - "LearningRates" + "lr" ], "Required": false, "SortOrder": 4.0, @@ -10948,8 +10829,7 @@ "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t", - "NumThreads" + "t" ], "Required": false, "SortOrder": 150.0, @@ -10973,8 +10853,7 @@ "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb", - "MaxBins" + "mb" ], "Required": false, "SortOrder": 150.0, @@ -10986,8 +10865,7 @@ "Type": "Float", "Desc": "Upper bound on absolute value of single output", "Aliases": [ - "mo", - "MaxOutput" + "mo" ], "Required": false, "SortOrder": 150.0, @@ -11011,8 +10889,7 @@ "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1", - "RngSeed" + "r1" ], "Required": false, "SortOrder": 150.0, @@ -25228,8 +25105,7 @@ "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter", - "NumTrees" + "iter" ], "Required": false, "SortOrder": 1.0, @@ -25260,8 +25136,7 @@ "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl", - "NumLeaves" + "nl" ], "Required": false, "SortOrder": 2.0, @@ -25292,8 +25167,7 @@ "Type": "Int", "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil", - "MinDocumentsInLeafs" + "mil" ], "Required": false, "SortOrder": 3.0, @@ -25325,8 +25199,7 @@ "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr", - "LearningRates" + "lr" ], "Required": false, "SortOrder": 4.0, @@ -25443,8 +25316,7 @@ "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps", - "NumPostBracketSteps" + "lssteps" ], "Required": false, "SortOrder": 150.0, @@ -25456,8 +25328,7 @@ "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep", - "MinStepSize" + "minstep" ], "Required": false, "SortOrder": 150.0, @@ -25627,8 +25498,7 @@ "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo", - "MaxTreeOutput" + "mo" ], "Required": false, "SortOrder": 150.0, @@ -25717,8 +25587,7 @@ "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t", - "NumThreads" + "t" ], "Required": false, "SortOrder": 150.0, @@ -25730,8 +25599,7 @@ "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1", - "RngSeed" + "r1" ], "Required": false, "SortOrder": 150.0, @@ -25743,8 +25611,7 @@ "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3", - "FeatureSelectSeed" + "r3" ], "Required": false, "SortOrder": 150.0, @@ -25816,8 +25683,7 @@ "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg", - "MaxCategoricalGroupsPerNode" + "mcg" ], "Required": false, "SortOrder": 150.0, @@ -25829,8 +25695,7 @@ "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat", - "MaxCategoricalSplitPoints" + "maxcat" ], "Required": false, "SortOrder": 150.0, @@ -25842,8 +25707,7 @@ "Type": "Float", "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ - "mdop", - "MinDocsPercentageForCategoricalSplit" + "mdop" ], "Required": false, "SortOrder": 150.0, @@ -25855,8 +25719,7 @@ "Type": "Int", "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ - "mdo", - "MinDocsForCategoricalSplit" + "mdo" ], "Required": false, "SortOrder": 150.0, @@ -25899,8 +25762,7 @@ "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb", - "MaxBins" + "mb" ], "Required": false, "SortOrder": 150.0, @@ -25972,8 +25834,7 @@ "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et", - "ExecutionTimes" + "et" ], "Required": false, "SortOrder": 150.0, @@ -26009,8 +25870,7 @@ "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac", - "BaggingTrainFraction" + "bagfrac" ], "Required": false, "SortOrder": 150.0, @@ -26022,8 +25882,7 @@ "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf", - "SplitFraction" + "sf" ], "Required": false, "SortOrder": 150.0, @@ -26084,8 +25943,7 @@ "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax", - "MaxTreesAfterCompression" + "cmpmax" ], "Required": false, "SortOrder": 150.0, @@ -26140,8 +25998,7 @@ "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter", - "NumTrees" + "iter" ], "Required": false, "SortOrder": 1.0, @@ -26172,8 +26029,7 @@ "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl", - "NumLeaves" + "nl" ], "Required": false, "SortOrder": 2.0, @@ -26204,8 +26060,7 @@ "Type": "Int", "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil", - "MinDocumentsInLeafs" + "mil" ], "Required": false, "SortOrder": 3.0, @@ -26237,8 +26092,7 @@ "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr", - "LearningRates" + "lr" ], "Required": false, "SortOrder": 4.0, @@ -26436,8 +26290,7 @@ "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps", - "NumPostBracketSteps" + "lssteps" ], "Required": false, "SortOrder": 150.0, @@ -26449,8 +26302,7 @@ "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep", - "MinStepSize" + "minstep" ], "Required": false, "SortOrder": 150.0, @@ -26620,8 +26472,7 @@ "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo", - "MaxTreeOutput" + "mo" ], "Required": false, "SortOrder": 150.0, @@ -26710,8 +26561,7 @@ "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t", - "NumThreads" + "t" ], "Required": false, "SortOrder": 150.0, @@ -26723,8 +26573,7 @@ "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1", - "RngSeed" + "r1" ], "Required": false, "SortOrder": 150.0, @@ -26736,8 +26585,7 @@ "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3", - "FeatureSelectSeed" + "r3" ], "Required": false, "SortOrder": 150.0, @@ -26809,8 +26657,7 @@ "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg", - "MaxCategoricalGroupsPerNode" + "mcg" ], "Required": false, "SortOrder": 150.0, @@ -26822,8 +26669,7 @@ "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat", - "MaxCategoricalSplitPoints" + "maxcat" ], "Required": false, "SortOrder": 150.0, @@ -26835,8 +26681,7 @@ "Type": "Float", "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ - "mdop", - "MinDocsPercentageForCategoricalSplit" + "mdop" ], "Required": false, "SortOrder": 150.0, @@ -26848,8 +26693,7 @@ "Type": "Int", "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ - "mdo", - "MinDocsForCategoricalSplit" + "mdo" ], "Required": false, "SortOrder": 150.0, @@ -26892,8 +26736,7 @@ "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb", - "MaxBins" + "mb" ], "Required": false, "SortOrder": 150.0, @@ -26965,8 +26808,7 @@ "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et", - "ExecutionTimes" + "et" ], "Required": false, "SortOrder": 150.0, @@ -27002,8 +26844,7 @@ "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac", - "BaggingTrainFraction" + "bagfrac" ], "Required": false, "SortOrder": 150.0, @@ -27015,8 +26856,7 @@ "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf", - "SplitFraction" + "sf" ], "Required": false, "SortOrder": 150.0, @@ -27077,8 +26917,7 @@ "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax", - "MaxTreesAfterCompression" + "cmpmax" ], "Required": false, "SortOrder": 150.0, @@ -27133,8 +26972,7 @@ "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter", - "NumTrees" + "iter" ], "Required": false, "SortOrder": 1.0, @@ -27165,8 +27003,7 @@ "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl", - "NumLeaves" + "nl" ], "Required": false, "SortOrder": 2.0, @@ -27197,8 +27034,7 @@ "Type": "Int", "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil", - "MinDocumentsInLeafs" + "mil" ], "Required": false, "SortOrder": 3.0, @@ -27230,8 +27066,7 @@ "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr", - "LearningRates" + "lr" ], "Required": false, "SortOrder": 4.0, @@ -27336,8 +27171,7 @@ "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps", - "NumPostBracketSteps" + "lssteps" ], "Required": false, "SortOrder": 150.0, @@ -27349,8 +27183,7 @@ "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep", - "MinStepSize" + "minstep" ], "Required": false, "SortOrder": 150.0, @@ -27520,8 +27353,7 @@ "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo", - "MaxTreeOutput" + "mo" ], "Required": false, "SortOrder": 150.0, @@ -27610,8 +27442,7 @@ "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t", - "NumThreads" + "t" ], "Required": false, "SortOrder": 150.0, @@ -27623,8 +27454,7 @@ "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1", - "RngSeed" + "r1" ], "Required": false, "SortOrder": 150.0, @@ -27636,8 +27466,7 @@ "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3", - "FeatureSelectSeed" + "r3" ], "Required": false, "SortOrder": 150.0, @@ -27709,8 +27538,7 @@ "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg", - "MaxCategoricalGroupsPerNode" + "mcg" ], "Required": false, "SortOrder": 150.0, @@ -27722,8 +27550,7 @@ "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat", - "MaxCategoricalSplitPoints" + "maxcat" ], "Required": false, "SortOrder": 150.0, @@ -27735,8 +27562,7 @@ "Type": "Float", "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ - "mdop", - "MinDocsPercentageForCategoricalSplit" + "mdop" ], "Required": false, "SortOrder": 150.0, @@ -27748,8 +27574,7 @@ "Type": "Int", "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ - "mdo", - "MinDocsForCategoricalSplit" + "mdo" ], "Required": false, "SortOrder": 150.0, @@ -27792,8 +27617,7 @@ "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb", - "MaxBins" + "mb" ], "Required": false, "SortOrder": 150.0, @@ -27865,8 +27689,7 @@ "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et", - "ExecutionTimes" + "et" ], "Required": false, "SortOrder": 150.0, @@ -27902,8 +27725,7 @@ "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac", - "BaggingTrainFraction" + "bagfrac" ], "Required": false, "SortOrder": 150.0, @@ -27915,8 +27737,7 @@ "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf", - "SplitFraction" + "sf" ], "Required": false, "SortOrder": 150.0, @@ -27977,8 +27798,7 @@ "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax", - "MaxTreesAfterCompression" + "cmpmax" ], "Required": false, "SortOrder": 150.0, @@ -28033,8 +27853,7 @@ "Type": "Int", "Desc": "Total number of decision trees to create in the ensemble", "Aliases": [ - "iter", - "NumTrees" + "iter" ], "Required": false, "SortOrder": 1.0, @@ -28065,8 +27884,7 @@ "Type": "Int", "Desc": "The max number of leaves in each regression tree", "Aliases": [ - "nl", - "NumLeaves" + "nl" ], "Required": false, "SortOrder": 2.0, @@ -28097,8 +27915,7 @@ "Type": "Int", "Desc": "The minimal number of examples allowed in a leaf of a regression tree, out of the subsampled data", "Aliases": [ - "mil", - "MinDocumentsInLeafs" + "mil" ], "Required": false, "SortOrder": 3.0, @@ -28130,8 +27947,7 @@ "Type": "Float", "Desc": "The learning rate", "Aliases": [ - "lr", - "LearningRates" + "lr" ], "Required": false, "SortOrder": 4.0, @@ -28245,8 +28061,7 @@ "Type": "Int", "Desc": "Number of post-bracket line search steps", "Aliases": [ - "lssteps", - "NumPostBracketSteps" + "lssteps" ], "Required": false, "SortOrder": 150.0, @@ -28258,8 +28073,7 @@ "Type": "Float", "Desc": "Minimum line search step size", "Aliases": [ - "minstep", - "MinStepSize" + "minstep" ], "Required": false, "SortOrder": 150.0, @@ -28429,8 +28243,7 @@ "Type": "Float", "Desc": "Upper bound on absolute value of single tree output", "Aliases": [ - "mo", - "MaxTreeOutput" + "mo" ], "Required": false, "SortOrder": 150.0, @@ -28519,8 +28332,7 @@ "Type": "Int", "Desc": "The number of threads to use", "Aliases": [ - "t", - "NumThreads" + "t" ], "Required": false, "SortOrder": 150.0, @@ -28532,8 +28344,7 @@ "Type": "Int", "Desc": "The seed of the random number generator", "Aliases": [ - "r1", - "RngSeed" + "r1" ], "Required": false, "SortOrder": 150.0, @@ -28545,8 +28356,7 @@ "Type": "Int", "Desc": "The seed of the active feature selection", "Aliases": [ - "r3", - "FeatureSelectSeed" + "r3" ], "Required": false, "SortOrder": 150.0, @@ -28618,8 +28428,7 @@ "Type": "Int", "Desc": "Maximum categorical split groups to consider when splitting on a categorical feature. Split groups are a collection of split points. This is used to reduce overfitting when there many categorical features.", "Aliases": [ - "mcg", - "MaxCategoricalGroupsPerNode" + "mcg" ], "Required": false, "SortOrder": 150.0, @@ -28631,8 +28440,7 @@ "Type": "Int", "Desc": "Maximum categorical split points to consider when splitting on a categorical feature.", "Aliases": [ - "maxcat", - "MaxCategoricalSplitPoints" + "maxcat" ], "Required": false, "SortOrder": 150.0, @@ -28644,8 +28452,7 @@ "Type": "Float", "Desc": "Minimum categorical example percentage in a bin to consider for a split.", "Aliases": [ - "mdop", - "MinDocsPercentageForCategoricalSplit" + "mdop" ], "Required": false, "SortOrder": 150.0, @@ -28657,8 +28464,7 @@ "Type": "Int", "Desc": "Minimum categorical example count in a bin to consider for a split.", "Aliases": [ - "mdo", - "MinDocsForCategoricalSplit" + "mdo" ], "Required": false, "SortOrder": 150.0, @@ -28701,8 +28507,7 @@ "Type": "Int", "Desc": "Maximum number of distinct values (bins) per feature", "Aliases": [ - "mb", - "MaxBins" + "mb" ], "Required": false, "SortOrder": 150.0, @@ -28774,8 +28579,7 @@ "Type": "Bool", "Desc": "Print execution time breakdown to stdout", "Aliases": [ - "et", - "ExecutionTimes" + "et" ], "Required": false, "SortOrder": 150.0, @@ -28811,8 +28615,7 @@ "Type": "Float", "Desc": "Percentage of training examples used in each bag", "Aliases": [ - "bagfrac", - "BaggingTrainFraction" + "bagfrac" ], "Required": false, "SortOrder": 150.0, @@ -28824,8 +28627,7 @@ "Type": "Float", "Desc": "The fraction of features (chosen randomly) to use on each split", "Aliases": [ - "sf", - "SplitFraction" + "sf" ], "Required": false, "SortOrder": 150.0, @@ -28886,8 +28688,7 @@ "Type": "Int", "Desc": "Maximum Number of trees after compression", "Aliases": [ - "cmpmax", - "MaxTreesAfterCompression" + "cmpmax" ], "Required": false, "SortOrder": 150.0, diff --git a/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs b/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs index 3b6613390f..bfa481778a 100644 --- a/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs +++ b/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs @@ -225,7 +225,7 @@ private string GetBuildPrefix() #endif } - [Fact] + [Fact(Skip = "Execute this test if you want to regenerate the core_manifest and core_ep_list files")] public void RegenerateEntryPointCatalog() { var (epListContents, jObj) = BuildManifests(); @@ -4971,8 +4971,8 @@ public void TestCrossValidationMacroWithNonDefaultNames() 'NormalizeQueryLambdas': false, 'BestStepRankingRegressionTrees': false, 'UseLineSearch': false, - 'NumPostBracketSteps': 0, - 'MinStepSize': 0.0, + 'MaximumNumberOfLineSearchSteps': 0, + 'MinimumStepSize': 0.0, 'OptimizationAlgorithm': 'GradientDescent', 'EarlyStoppingRule': null, 'EarlyStoppingMetrics': 1, @@ -4980,12 +4980,12 @@ public void TestCrossValidationMacroWithNonDefaultNames() 'UseTolerantPruning': false, 'PruningThreshold': 0.004, 'PruningWindowSize': 5, - 'LearningRates': 0.2, + 'LearningRate': 0.2, 'Shrinkage': 1.0, 'DropoutRate': 0.0, 'GetDerivativesSampleRate': 1, 'WriteLastEnsemble': false, - 'MaxTreeOutput': 100.0, + 'MaximumTreeOutput': 100.0, 'RandomStart': false, 'FilterZeroLambdas': false, 'BaselineScoresFormula': null, @@ -4995,39 +4995,39 @@ public void TestCrossValidationMacroWithNonDefaultNames() 'Name': 'Single', 'Settings': {} }, - 'NumThreads': 1, - 'RngSeed': 123, - 'FeatureSelectSeed': 123, + 'NumberOfThreads': 1, + 'Seed': 123, + 'FeatureSelectionSeed': 123, 'EntropyCoefficient': 0.0, 'HistogramPoolSize': -1, 'DiskTranspose': null, 'FeatureFlocks': true, 'CategoricalSplit': false, - 'MaxCategoricalGroupsPerNode': 64, - 'MaxCategoricalSplitPoints': 64, - 'MinDocsPercentageForCategoricalSplit': 0.001, - 'MinDocsForCategoricalSplit': 100, + 'MaximumCategoricalGroupCountPerNode': 64, + 'MaximumCategoricalSplitPointCount': 64, + 'MinimumExampleFractionForCategoricalSplit': 0.001, + 'MinimumExamplesForCategoricalSplit': 100, 'Bias': 0.0, 'Bundling': 'None', - 'MaxBins': 255, + 'MaximumBinCountPerFeature': 255, 'SparsifyThreshold': 0.7, 'FeatureFirstUsePenalty': 0.0, 'FeatureReusePenalty': 0.0, 'GainConfidenceLevel': 0.0, 'SoftmaxTemperature': 0.0, - 'ExecutionTimes': false, - 'NumLeaves': 20, - 'MinDocumentsInLeafs': 10, - 'NumTrees': 100, + 'ExecutionTime': false, + 'NumberOfLeaves': 20, + 'MinimumExampleCountPerLeaf': 10, + 'NumberOfTrees': 100, 'FeatureFraction': 1.0, 'BaggingSize': 0, - 'BaggingTrainFraction': 0.7, - 'SplitFraction': 1.0, + 'BaggingExampleFraction': 0.7, + 'FeatureFractionPerSplit': 1.0, 'Smoothing': 0.0, 'AllowEmptyTrees': true, 'FeatureCompressionLevel': 1, 'CompressEnsemble': false, - 'MaxTreesAfterCompression': -1, + 'MaximumTreeCountAfterCompression': -1, 'PrintTestGraph': false, 'PrintTrainValidGraph': false, 'TestFrequency': 2147483647, diff --git a/test/Microsoft.ML.TestFramework/TestCommandBase.cs b/test/Microsoft.ML.TestFramework/TestCommandBase.cs index 740d2fc5a0..16aa66bd5f 100644 --- a/test/Microsoft.ML.TestFramework/TestCommandBase.cs +++ b/test/Microsoft.ML.TestFramework/TestCommandBase.cs @@ -699,7 +699,7 @@ public void CommandShowSchemaModel() col=Label:Num:0}} xf=Categorical{{col=CatFeatures:CatFeaturesText}} xf=Concat{{col=Features:NumFeatures,CatFeatures}} - trainer=ft{{iter=1 numLeaves=2}} + trainer=ft{{numberOfTrees=1 numberOfLeaves=2}} out={{{1}}}", trainDataPath, modelPath); RunMTAThread(new ThreadStart(() => MainForTest(args))); TestCore("showschema", string.Format("steps+ in={{{0}}} meta+", modelPath)); diff --git a/test/Microsoft.ML.Tests/OnnxConversionTest.cs b/test/Microsoft.ML.Tests/OnnxConversionTest.cs index 5225391498..c3ec209076 100644 --- a/test/Microsoft.ML.Tests/OnnxConversionTest.cs +++ b/test/Microsoft.ML.Tests/OnnxConversionTest.cs @@ -180,7 +180,7 @@ void CommandLineOnnxConversionTest() string dataPath = GetDataPath("breast-cancer.txt"); string modelPath = GetOutputPath("ModelWithLessIO.zip"); var trainingPathArgs = $"data={dataPath} out={modelPath}"; - var trainingArgs = " loader=text{col=Label:BL:0 col=F1:R4:1-8 col=F2:TX:9} xf=Cat{col=F2} xf=Concat{col=Features:F1,F2} tr=ft{numThreads=1 numLeaves=8 numTrees=3} seed=1"; + var trainingArgs = " loader=text{col=Label:BL:0 col=F1:R4:1-8 col=F2:TX:9} xf=Cat{col=F2} xf=Concat{col=Features:F1,F2} tr=ft{numberOfThreads=1 numberOfLeaves=8 numberOfTrees=3} seed=1"; Assert.Equal(0, Maml.Main(new[] { "train " + trainingPathArgs + trainingArgs})); var subDir = Path.Combine("..", "..", "BaselineOutput", "Common", "Onnx", "BinaryClassification", "BreastCancer"); From e9745b65b86ecd3de06d846c1b45115e1dd9d6cc Mon Sep 17 00:00:00 2001 From: Wei-Sheng Chin Date: Mon, 4 Mar 2019 14:28:12 -0800 Subject: [PATCH 09/12] Address some comments --- .../FastTreeArguments.cs | 31 ++-- src/Microsoft.ML.FastTree/FastTreeRanking.cs | 35 ++-- src/Microsoft.ML.FastTree/RegressionTree.cs | 22 +-- .../Common/EntryPoints/core_manifest.json | 154 +++--------------- .../UnitTests/TestEntryPoints.cs | 7 +- .../TreeRepresentation.cs | 16 +- .../Api/Estimators/IntrospectiveTraining.cs | 8 +- 7 files changed, 79 insertions(+), 194 deletions(-) diff --git a/src/Microsoft.ML.FastTree/FastTreeArguments.cs b/src/Microsoft.ML.FastTree/FastTreeArguments.cs index 0f43b7ea33..c5ed19e768 100644 --- a/src/Microsoft.ML.FastTree/FastTreeArguments.cs +++ b/src/Microsoft.ML.FastTree/FastTreeArguments.cs @@ -75,38 +75,43 @@ public sealed class Options : BoostedTreeOptions, IFastTreeTrainerFactory { [Argument(ArgumentType.LastOccurenceWins, HelpText = "Comma seperated list of gains associated to each relevance label.", ShortName = "gains")] [TGUI(NoSweep = true)] - public string CustomGains = "0,3,7,15,31"; + public double[] CustomGains = new double[] { 0, 3, 7, 15, 31 }; [Argument(ArgumentType.LastOccurenceWins, HelpText = "Train DCG instead of NDCG", ShortName = "dcg")] - public bool TrainDcg; + public bool UseDcg; // REVIEW: Hiding sorting for now. Should be an enum or component factory. + [BestFriend] [Argument(ArgumentType.LastOccurenceWins, HelpText = "The sorting algorithm to use for DCG and LambdaMart calculations [DescendingStablePessimistic/DescendingStable/DescendingReverse/DescendingDotNet]", ShortName = "sort", Hide = true)] [TGUI(NotGui = true)] - public string SortingAlgorithm = "DescendingStablePessimistic"; + internal string SortingAlgorithm = "DescendingStablePessimistic"; [Argument(ArgumentType.AtMostOnce, HelpText = "max-NDCG truncation to use in the Lambda Mart algorithm", ShortName = "n", Hide = true)] [TGUI(NotGui = true)] - public int LambdaMartMaxTruncation = 100; + public int NdcgTruncationLevel = 100; + [BestFriend] [Argument(ArgumentType.LastOccurenceWins, HelpText = "Use shifted NDCG", Hide = true)] [TGUI(NotGui = true)] - public bool ShiftedNdcg; + internal bool ShiftedNdcg; + [BestFriend] [Argument(ArgumentType.AtMostOnce, HelpText = "Cost function parameter (w/c)", ShortName = "cf", Hide = true)] [TGUI(NotGui = true)] - public char CostFunctionParam = 'w'; + internal char CostFunctionParam = 'w'; + [BestFriend] [Argument(ArgumentType.LastOccurenceWins, HelpText = "Distance weight 2 adjustment to cost", ShortName = "dw", Hide = true)] [TGUI(NotGui = true)] - public bool DistanceWeight2; + internal bool DistanceWeight2; + [BestFriend] [Argument(ArgumentType.LastOccurenceWins, HelpText = "Normalize query lambdas", ShortName = "nql", Hide = true)] [TGUI(NotGui = true)] - public bool NormalizeQueryLambdas; + internal bool NormalizeQueryLambdas; public Options() { @@ -129,7 +134,7 @@ internal override void Check(IExceptionContext ectx) #if OLD_DATALOAD ectx.CheckUserArg(0 <= secondaryMetricShare && secondaryMetricShare <= 1, "secondaryMetricShare", "secondaryMetricShare must be between 0 and 1."); #endif - ectx.CheckUserArg(0 < LambdaMartMaxTruncation, nameof(LambdaMartMaxTruncation), "lambdaMartMaxTruncation must be positive."); + ectx.CheckUserArg(0 < NdcgTruncationLevel, nameof(NdcgTruncationLevel), "lambdaMartMaxTruncation must be positive."); } } } @@ -387,14 +392,6 @@ public abstract class TreeOptions : TrainerInputBaseWithGroupId [TGUI(NotGui = true)] public bool CompressEnsemble; - /// - /// Maximum Number of trees after compression. - /// - // REVIEW: Not used. - [Argument(ArgumentType.AtMostOnce, HelpText = "Maximum Number of trees after compression", ShortName = "cmpmax", Hide = true)] - [TGUI(NotGui = true)] - public int MaximumTreeCountAfterCompression = -1; - /// /// Print metrics graph for the first test set. /// diff --git a/src/Microsoft.ML.FastTree/FastTreeRanking.cs b/src/Microsoft.ML.FastTree/FastTreeRanking.cs index a40d5a7ef0..6db1145e7c 100644 --- a/src/Microsoft.ML.FastTree/FastTreeRanking.cs +++ b/src/Microsoft.ML.FastTree/FastTreeRanking.cs @@ -131,7 +131,7 @@ private Double[] GetLabelGains() try { Host.AssertValue(FastTreeTrainerOptions.CustomGains); - return FastTreeTrainerOptions.CustomGains.Split(',').Select(k => Convert.ToDouble(k.Trim())).ToArray(); + return FastTreeTrainerOptions.CustomGains; } catch (Exception ex) { @@ -143,26 +143,17 @@ private Double[] GetLabelGains() private protected override void CheckOptions(IChannel ch) { - if (!string.IsNullOrEmpty(FastTreeTrainerOptions.CustomGains)) + if (FastTreeTrainerOptions.CustomGains != null) { - var stringGain = FastTreeTrainerOptions.CustomGains.Split(','); - if (stringGain.Length < 5) + var gains = FastTreeTrainerOptions.CustomGains; + if (gains.Length < 5) { throw ch.ExceptUserArg(nameof(FastTreeTrainerOptions.CustomGains), - "{0} an invalid number of gain levels. We require at least 5. Make certain they're comma separated.", - stringGain.Length); + "Has {0} gain levels. We require at least 5 elements.", + gains.Length); } - Double[] gain = new Double[stringGain.Length]; - for (int i = 0; i < stringGain.Length; ++i) - { - if (!Double.TryParse(stringGain[i], out gain[i])) - { - throw ch.ExceptUserArg(nameof(FastTreeTrainerOptions.CustomGains), - "Could not parse '{0}' as a floating point number", stringGain[0]); - } - } - DcgCalculator.LabelGainMap = gain; - Dataset.DatasetSkeleton.LabelGainMap = gain; + DcgCalculator.LabelGainMap = gains; + Dataset.DatasetSkeleton.LabelGainMap = gains; } ch.CheckUserArg((FastTreeTrainerOptions.EarlyStoppingRule == null && !FastTreeTrainerOptions.EnablePruning) || (FastTreeTrainerOptions.EarlyStoppingMetrics == 1 || FastTreeTrainerOptions.EarlyStoppingMetrics == 3), nameof(FastTreeTrainerOptions.EarlyStoppingMetrics), @@ -498,7 +489,7 @@ private enum DupeIdInfo // parameters private int _maxDcgTruncationLevel; - private bool _trainDcg; + private bool _useDcg; // A lookup table for the sigmoid used in the lambda calculation // Note: Is built for a specific sigmoid parameter, so assumes this will be constant throughout computation private double[] _sigmoidTable; @@ -570,9 +561,9 @@ public LambdaRankObjectiveFunction(Dataset trainset, short[] labels, Options opt _labelCounts[q] = new int[relevancyLevel]; // precomputed arrays - _maxDcgTruncationLevel = options.LambdaMartMaxTruncation; - _trainDcg = options.TrainDcg; - if (_trainDcg) + _maxDcgTruncationLevel = options.NdcgTruncationLevel; + _useDcg = options.UseDcg; + if (_useDcg) { _inverseMaxDcgt = new double[Dataset.NumQueries]; for (int q = 0; q < Dataset.NumQueries; ++q) @@ -875,7 +866,7 @@ protected override void GetGradientInOneQuery(int query, int threadIndex) // Continous cost function and shifted NDCG require a re-sort and recomputation of maxDCG // (Change of scores in the former and scores and labels in the latter) - if (!_trainDcg && (_costFunctionParam == 'c' || _useShiftedNdcg)) + if (!_useDcg && (_costFunctionParam == 'c' || _useShiftedNdcg)) { PermutationSort(permutation, scoresToUse, labels, numDocuments, begin); inverseMaxDcg = 1.0 / DcgCalculator.MaxDcgQuery(labels, begin, numDocuments, numDocuments, _labelCounts[query]); diff --git a/src/Microsoft.ML.FastTree/RegressionTree.cs b/src/Microsoft.ML.FastTree/RegressionTree.cs index 9f54935d50..0645a9f57f 100644 --- a/src/Microsoft.ML.FastTree/RegressionTree.cs +++ b/src/Microsoft.ML.FastTree/RegressionTree.cs @@ -21,11 +21,11 @@ public abstract class RegressionTreeBase private readonly InternalRegressionTree _tree; /// - /// See . + /// See . /// private readonly ImmutableArray _lteChild; /// - /// See . + /// See . /// private readonly ImmutableArray _gtChild; /// @@ -50,9 +50,9 @@ public abstract class RegressionTreeBase private readonly ImmutableArray _splitGains; /// - /// [i] is the i-th node's child index used when - /// (1) the numerical feature indexed by [i] is less than the - /// threshold [i], or + /// [i] is the i-th node's child index used when + /// (1) the numerical feature indexed by [i] is less than or equal + /// to the threshold [i], or /// (2) the categorical features indexed by 's /// returned value with nodeIndex=i is NOT a sub-set of with /// nodeIndex=i. @@ -63,14 +63,14 @@ public abstract class RegressionTreeBase /// bitwise complement operator in C#; for details, see /// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/bitwise-complement-operator. /// - public IReadOnlyList LessThanOrEqualToThresholdChildren => _lteChild; + public IReadOnlyList LeftChild => _lteChild; /// - /// [i] is the i-th node's child index used when the two conditions, (1) and (2), - /// described in 's document are not true. Its return value follows the format - /// used in . + /// [i] is the i-th node's child index used when the two conditions, (1) and (2), + /// described in 's document are not true. Its return value follows the format + /// used in . /// - public IReadOnlyList GreaterThanThresholdChildren => _gtChild; + public IReadOnlyList RightChild => _gtChild; /// /// [i] is the feature index used the splitting function of the @@ -99,7 +99,7 @@ public abstract class RegressionTreeBase /// /// Return categorical thresholds used at node indexed by nodeIndex. If the considered input feature does NOT /// matche any of values returned by , we call it a - /// less-than-threshold event and therefore [nodeIndex] is the child node that input + /// less-than-threshold event and therefore [nodeIndex] is the child node that input /// should go next. The returned value is valid only if [nodeIndex] is true. /// public IReadOnlyList GetCategoricalSplitFeaturesAt(int nodeIndex) diff --git a/test/BaselineOutput/Common/EntryPoints/core_manifest.json b/test/BaselineOutput/Common/EntryPoints/core_manifest.json index 4b4fe9929b..42acc03bc9 100644 --- a/test/BaselineOutput/Common/EntryPoints/core_manifest.json +++ b/test/BaselineOutput/Common/EntryPoints/core_manifest.json @@ -5670,18 +5670,6 @@ "IsNullable": false, "Default": false }, - { - "Name": "MaximumTreeCountAfterCompression", - "Type": "Int", - "Desc": "Maximum Number of trees after compression", - "Aliases": [ - "cmpmax" - ], - "Required": false, - "SortOrder": 150.0, - "IsNullable": false, - "Default": -1 - }, { "Name": "PrintTestGraph", "Type": "Bool", @@ -6294,18 +6282,6 @@ "IsNullable": false, "Default": false }, - { - "Name": "MaximumTreeCountAfterCompression", - "Type": "Int", - "Desc": "Maximum Number of trees after compression", - "Aliases": [ - "cmpmax" - ], - "Required": false, - "SortOrder": 150.0, - "IsNullable": false, - "Default": -1 - }, { "Name": "PrintTestGraph", "Type": "Bool", @@ -7205,18 +7181,6 @@ "IsNullable": false, "Default": false }, - { - "Name": "MaximumTreeCountAfterCompression", - "Type": "Int", - "Desc": "Maximum Number of trees after compression", - "Aliases": [ - "cmpmax" - ], - "Required": false, - "SortOrder": 150.0, - "IsNullable": false, - "Default": -1 - }, { "Name": "PrintTestGraph", "Type": "Bool", @@ -7455,7 +7419,10 @@ }, { "Name": "CustomGains", - "Type": "String", + "Type": { + "Kind": "Array", + "ItemType": "Float" + }, "Desc": "Comma seperated list of gains associated to each relevance label.", "Aliases": [ "gains" @@ -7463,10 +7430,16 @@ "Required": false, "SortOrder": 150.0, "IsNullable": false, - "Default": "0,3,7,15,31" + "Default": [ + 0.0, + 3.0, + 7.0, + 15.0, + 31.0 + ] }, { - "Name": "TrainDcg", + "Name": "UseDcg", "Type": "Bool", "Desc": "Train DCG instead of NDCG", "Aliases": [ @@ -7490,7 +7463,7 @@ "Default": "DescendingStablePessimistic" }, { - "Name": "LambdaMartMaxTruncation", + "Name": "NdcgTruncationLevel", "Type": "Int", "Desc": "max-NDCG truncation to use in the Lambda Mart algorithm", "Aliases": [ @@ -8197,18 +8170,6 @@ "IsNullable": false, "Default": false }, - { - "Name": "MaximumTreeCountAfterCompression", - "Type": "Int", - "Desc": "Maximum Number of trees after compression", - "Aliases": [ - "cmpmax" - ], - "Required": false, - "SortOrder": 150.0, - "IsNullable": false, - "Default": -1 - }, { "Name": "PrintTestGraph", "Type": "Bool", @@ -9096,18 +9057,6 @@ "IsNullable": false, "Default": false }, - { - "Name": "MaximumTreeCountAfterCompression", - "Type": "Int", - "Desc": "Maximum Number of trees after compression", - "Aliases": [ - "cmpmax" - ], - "Required": false, - "SortOrder": 150.0, - "IsNullable": false, - "Default": -1 - }, { "Name": "PrintTestGraph", "Type": "Bool", @@ -10004,18 +9953,6 @@ "IsNullable": false, "Default": false }, - { - "Name": "MaximumTreeCountAfterCompression", - "Type": "Int", - "Desc": "Maximum Number of trees after compression", - "Aliases": [ - "cmpmax" - ], - "Required": false, - "SortOrder": 150.0, - "IsNullable": false, - "Default": -1 - }, { "Name": "PrintTestGraph", "Type": "Bool", @@ -25938,18 +25875,6 @@ "IsNullable": false, "Default": false }, - { - "Name": "MaximumTreeCountAfterCompression", - "Type": "Int", - "Desc": "Maximum Number of trees after compression", - "Aliases": [ - "cmpmax" - ], - "Required": false, - "SortOrder": 150.0, - "IsNullable": false, - "Default": -1 - }, { "Name": "PrintTestGraph", "Type": "Bool", @@ -26170,7 +26095,10 @@ }, { "Name": "CustomGains", - "Type": "String", + "Type": { + "Kind": "Array", + "ItemType": "Float" + }, "Desc": "Comma seperated list of gains associated to each relevance label.", "Aliases": [ "gains" @@ -26178,10 +26106,16 @@ "Required": false, "SortOrder": 150.0, "IsNullable": false, - "Default": "0,3,7,15,31" + "Default": [ + 0.0, + 3.0, + 7.0, + 15.0, + 31.0 + ] }, { - "Name": "TrainDcg", + "Name": "UseDcg", "Type": "Bool", "Desc": "Train DCG instead of NDCG", "Aliases": [ @@ -26205,7 +26139,7 @@ "Default": "DescendingStablePessimistic" }, { - "Name": "LambdaMartMaxTruncation", + "Name": "NdcgTruncationLevel", "Type": "Int", "Desc": "max-NDCG truncation to use in the Lambda Mart algorithm", "Aliases": [ @@ -26912,18 +26846,6 @@ "IsNullable": false, "Default": false }, - { - "Name": "MaximumTreeCountAfterCompression", - "Type": "Int", - "Desc": "Maximum Number of trees after compression", - "Aliases": [ - "cmpmax" - ], - "Required": false, - "SortOrder": 150.0, - "IsNullable": false, - "Default": -1 - }, { "Name": "PrintTestGraph", "Type": "Bool", @@ -27793,18 +27715,6 @@ "IsNullable": false, "Default": false }, - { - "Name": "MaximumTreeCountAfterCompression", - "Type": "Int", - "Desc": "Maximum Number of trees after compression", - "Aliases": [ - "cmpmax" - ], - "Required": false, - "SortOrder": 150.0, - "IsNullable": false, - "Default": -1 - }, { "Name": "PrintTestGraph", "Type": "Bool", @@ -28683,18 +28593,6 @@ "IsNullable": false, "Default": false }, - { - "Name": "MaximumTreeCountAfterCompression", - "Type": "Int", - "Desc": "Maximum Number of trees after compression", - "Aliases": [ - "cmpmax" - ], - "Required": false, - "SortOrder": 150.0, - "IsNullable": false, - "Default": -1 - }, { "Name": "PrintTestGraph", "Type": "Bool", diff --git a/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs b/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs index bfa481778a..a94ca5c5fd 100644 --- a/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs +++ b/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs @@ -4961,10 +4961,10 @@ public void TestCrossValidationMacroWithNonDefaultNames() }, { 'Name': 'Trainers.FastTreeRanker', 'Inputs': { - 'CustomGains': '0,3,7,15,31', - 'TrainDcg': false, + 'CustomGains': [0,3,7,15,31], + 'UseDcg': false, 'SortingAlgorithm': 'DescendingStablePessimistic', - 'LambdaMartMaxTruncation': 100, + 'NdcgTruncationLevel': 100, 'ShiftedNdcg': false, 'CostFunctionParam': 'w', 'DistanceWeight2': false, @@ -5027,7 +5027,6 @@ public void TestCrossValidationMacroWithNonDefaultNames() 'AllowEmptyTrees': true, 'FeatureCompressionLevel': 1, 'CompressEnsemble': false, - 'MaximumTreeCountAfterCompression': -1, 'PrintTestGraph': false, 'PrintTrainValidGraph': false, 'TestFrequency': 2147483647, diff --git a/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs b/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs index 79f640b618..ac790fecfe 100644 --- a/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs +++ b/test/Microsoft.ML.StaticPipelineTesting/TreeRepresentation.cs @@ -62,12 +62,12 @@ public void FastTreeRegressionRepresentation() Assert.Equal(0, categoricalSplitFeatureRange.Count); var expectedGtChild = new int[] { 3, 2, -4, -5 }; - Assert.Equal(4, trees[0].GreaterThanThresholdChildren.Count); - Assert.Equal(expectedGtChild, trees[0].GreaterThanThresholdChildren); + Assert.Equal(4, trees[0].RightChild.Count); + Assert.Equal(expectedGtChild, trees[0].RightChild); var expectedLteChild = new int[] { 1, -1, -3, -2 }; - Assert.Equal(4, trees[0].LessThanOrEqualToThresholdChildren.Count); - Assert.Equal(expectedLteChild, trees[0].LessThanOrEqualToThresholdChildren); + Assert.Equal(4, trees[0].LeftChild.Count); + Assert.Equal(expectedLteChild, trees[0].LeftChild); var expectedCategoricalSplitFlags = new bool[] { false, false, false, false }; Assert.Equal(4, trees[0].CategoricalSplitFlags.Count); @@ -136,12 +136,12 @@ public void FastTreeRegressionRepresentationWithCategoricalSplit() Assert.Equal(4, trees[0].NumberOfNodes); var expectedGtChild = new int[] { 3, -3, -4, -5 }; - Assert.Equal(4, trees[0].GreaterThanThresholdChildren.Count); - Assert.Equal(expectedGtChild, trees[0].GreaterThanThresholdChildren); + Assert.Equal(4, trees[0].RightChild.Count); + Assert.Equal(expectedGtChild, trees[0].RightChild); var expectedLteChild = new int[] { 1, 2, -1, -2 }; - Assert.Equal(4, trees[0].LessThanOrEqualToThresholdChildren.Count); - Assert.Equal(expectedLteChild, trees[0].LessThanOrEqualToThresholdChildren); + Assert.Equal(4, trees[0].LeftChild.Count); + Assert.Equal(expectedLteChild, trees[0].LeftChild); var expectedCategoricalSplitFlags = new bool[] { true, true, true, true }; Assert.Equal(4, trees[0].CategoricalSplitFlags.Count); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs index d9f7221c5b..dc8691072d 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs @@ -76,8 +76,8 @@ public void FastTreeClassificationIntrospectiveTraining() Assert.Equal(5, tree.NumberOfLeaves); Assert.Equal(4, tree.NumberOfNodes); - Assert.Equal(tree.LessThanOrEqualToThresholdChildren, new int[] { 2, -2, -1, -3 }); - Assert.Equal(tree.GreaterThanThresholdChildren, new int[] { 1, 3, -4, -5 }); + Assert.Equal(tree.LeftChild, new int[] { 2, -2, -1, -3 }); + Assert.Equal(tree.RightChild, new int[] { 1, 3, -4, -5 }); Assert.Equal(tree.NumericalSplitFeatureIndexes, new int[] { 14, 294, 633, 266 }); Assert.Equal(tree.SplitGains.Count, tree.NumberOfNodes); Assert.Equal(tree.NumericalSplitThresholds.Count, tree.NumberOfNodes); @@ -121,8 +121,8 @@ public void FastForestRegressionIntrospectiveTraining() Assert.Equal(5, tree.NumberOfLeaves); Assert.Equal(4, tree.NumberOfNodes); - Assert.Equal(tree.LessThanOrEqualToThresholdChildren, new int[] { -1, -2, -3, -4 }); - Assert.Equal(tree.GreaterThanThresholdChildren, new int[] { 1, 2, 3, -5 }); + Assert.Equal(tree.LeftChild, new int[] { -1, -2, -3, -4 }); + Assert.Equal(tree.RightChild, new int[] { 1, 2, 3, -5 }); Assert.Equal(tree.NumericalSplitFeatureIndexes, new int[] { 9, 0, 1, 8 }); Assert.Equal(tree.SplitGains.Count, tree.NumberOfNodes); Assert.Equal(tree.NumericalSplitThresholds.Count, tree.NumberOfNodes); From 8e937621aac8d9a1dfdbf2eff6b085add2216515 Mon Sep 17 00:00:00 2001 From: Wei-Sheng Chin Date: Mon, 4 Mar 2019 15:32:53 -0800 Subject: [PATCH 10/12] Improve early-stopping metric field --- .../FastTreeArguments.cs | 143 +++++++++++++++++- .../Validation.cs | 2 +- 2 files changed, 142 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.ML.FastTree/FastTreeArguments.cs b/src/Microsoft.ML.FastTree/FastTreeArguments.cs index c5ed19e768..baead7aebc 100644 --- a/src/Microsoft.ML.FastTree/FastTreeArguments.cs +++ b/src/Microsoft.ML.FastTree/FastTreeArguments.cs @@ -20,12 +20,43 @@ internal interface IFastTreeTrainerFactory : IComponentFactory { } + /// + /// Stopping measurements for classification and regression. + /// + public enum EarlyStoppingMetric + { + /// + /// L1-norm of gradient. + /// + L1Norm = 1, + /// + /// L2-norm of gradient. + /// + L2Norm = 2 + }; + + /// + /// Stopping measurements for ranking. + /// + public enum EarlyStoppingRankingMetric + { + /// + /// NDCG@1 + /// + NdcgAt1 = 1, + /// + /// NDCG@3 + /// + NdcgAt3 = 3 + } + /// public sealed partial class FastTreeBinaryClassificationTrainer { [TlcModule.Component(Name = LoadNameValue, FriendlyName = UserNameValue, Desc = Summary)] public sealed class Options : BoostedTreeOptions, IFastTreeTrainerFactory { + /// /// Option for using derivatives optimized for unbalanced sets. /// @@ -33,6 +64,37 @@ public sealed class Options : BoostedTreeOptions, IFastTreeTrainerFactory [TGUI(Label = "Optimize for unbalanced")] public bool UnbalancedSets = false; + /// + /// internal state of . It should be always synced with + /// . + /// + // Disable 649 because Visual Studio can't detect its assignment via property. + #pragma warning disable 649 + private EarlyStoppingMetric _earlyStoppingMetric; + #pragma warning restore 649 + + /// + /// Early stopping metrics. + /// + public EarlyStoppingMetric EarlyStoppingMetric + { + get { return _earlyStoppingMetric; } + + set + { + // Update the state of the user-facing stopping metric. + _earlyStoppingMetric = value; + // Set up internal property according to its public value. + EarlyStoppingMetrics = (int)_earlyStoppingMetric; + } + } + + public Options() + { + // Use L1 by default. + EarlyStoppingMetric = EarlyStoppingMetric.L1Norm; + } + ITrainer IComponentFactory.CreateComponent(IHostEnvironment env) => new FastTreeBinaryClassificationTrainer(env, this); } } @@ -42,9 +104,31 @@ public sealed partial class FastTreeRegressionTrainer [TlcModule.Component(Name = LoadNameValue, FriendlyName = UserNameValue, Desc = Summary)] public sealed class Options : BoostedTreeOptions, IFastTreeTrainerFactory { + /// + /// internal state of . It should be always synced with + /// . + /// + private EarlyStoppingMetric _earlyStoppingMetric; + + /// + /// Early stopping metrics. + /// + public EarlyStoppingMetric EarlyStoppingMetric + { + get { return _earlyStoppingMetric; } + + set + { + // Update the state of the user-facing stopping metric. + _earlyStoppingMetric = value; + // Set up internal property according to its public value. + EarlyStoppingMetrics = (int)_earlyStoppingMetric; + } + } + public Options() { - EarlyStoppingMetrics = 1; // Use L1 by default. + EarlyStoppingMetric = EarlyStoppingMetric.L1Norm; // Use L1 by default. } ITrainer IComponentFactory.CreateComponent(IHostEnvironment env) => new FastTreeRegressionTrainer(env, this); @@ -64,6 +148,36 @@ public sealed class Options : BoostedTreeOptions, IFastTreeTrainerFactory "and intermediate values are compound Poisson loss.")] public Double Index = 1.5; + /// + /// internal state of . It should be always synced with + /// . + /// + // Disable 649 because Visual Studio can't detect its assignment via property. + #pragma warning disable 649 + private EarlyStoppingMetric _earlyStoppingMetric; + #pragma warning restore 649 + + /// + /// Early stopping metrics. + /// + public EarlyStoppingMetric EarlyStoppingMetric + { + get { return _earlyStoppingMetric; } + + set + { + // Update the state of the user-facing stopping metric. + _earlyStoppingMetric = value; + // Set up internal property according to its public value. + EarlyStoppingMetrics = (int)_earlyStoppingMetric; + } + } + + public Options() + { + EarlyStoppingMetric = EarlyStoppingMetric.L1Norm; // Use L1 by default. + } + ITrainer IComponentFactory.CreateComponent(IHostEnvironment env) => new FastTreeTweedieTrainer(env, this); } } @@ -113,9 +227,34 @@ public sealed class Options : BoostedTreeOptions, IFastTreeTrainerFactory [TGUI(NotGui = true)] internal bool NormalizeQueryLambdas; + /// + /// internal state of . It should be always synced with + /// . + /// + // Disable 649 because Visual Studio can't detect its assignment via property. + #pragma warning disable 649 + private EarlyStoppingRankingMetric _earlyStoppingMetric; + #pragma warning restore 649 + + /// + /// Early stopping metrics. + /// + public EarlyStoppingRankingMetric EarlyStoppingMetric + { + get { return _earlyStoppingMetric; } + + set + { + // Update the state of the user-facing stopping metric. + _earlyStoppingMetric = value; + // Set up internal property according to its public value. + EarlyStoppingMetrics = (int)_earlyStoppingMetric; + } + } + public Options() { - EarlyStoppingMetrics = 1; + EarlyStoppingMetric = EarlyStoppingRankingMetric.NdcgAt1; // Use L1 by default. } ITrainer IComponentFactory.CreateComponent(IHostEnvironment env) => new FastTreeRankingTrainer(env, this); diff --git a/test/Microsoft.ML.Functional.Tests/Validation.cs b/test/Microsoft.ML.Functional.Tests/Validation.cs index 4b9ad67ca9..cb0cacfc7e 100644 --- a/test/Microsoft.ML.Functional.Tests/Validation.cs +++ b/test/Microsoft.ML.Functional.Tests/Validation.cs @@ -83,7 +83,7 @@ public void TrainWithValidationSet() // Train the model with a validation set. var trainedModel = mlContext.Regression.Trainers.FastTree(new Trainers.FastTree.FastTreeRegressionTrainer.Options { NumberOfTrees = 2, - EarlyStoppingMetrics = 2, + EarlyStoppingMetric = EarlyStoppingMetric.L2Norm, EarlyStoppingRule = new GLEarlyStoppingCriterion.Options() }) .Fit(trainData: preprocessedTrainData, validationData: preprocessedValidData); From 004d4cc9d0b6675a771d7ce07223957733ed6958 Mon Sep 17 00:00:00 2001 From: Wei-Sheng Chin Date: Mon, 4 Mar 2019 15:45:12 -0800 Subject: [PATCH 11/12] Update entry points --- test/BaselineOutput/Common/EntryPoints/core_manifest.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/BaselineOutput/Common/EntryPoints/core_manifest.json b/test/BaselineOutput/Common/EntryPoints/core_manifest.json index 42acc03bc9..b753141da4 100644 --- a/test/BaselineOutput/Common/EntryPoints/core_manifest.json +++ b/test/BaselineOutput/Common/EntryPoints/core_manifest.json @@ -6622,7 +6622,7 @@ "Required": false, "SortOrder": 150.0, "IsNullable": false, - "Default": 0 + "Default": 1 }, { "Name": "EnablePruning", @@ -9394,7 +9394,7 @@ "Required": false, "SortOrder": 150.0, "IsNullable": false, - "Default": 0 + "Default": 1 }, { "Name": "EnablePruning", @@ -25316,7 +25316,7 @@ "Required": false, "SortOrder": 150.0, "IsNullable": false, - "Default": 0 + "Default": 1 }, { "Name": "EnablePruning", @@ -28034,7 +28034,7 @@ "Required": false, "SortOrder": 150.0, "IsNullable": false, - "Default": 0 + "Default": 1 }, { "Name": "EnablePruning", From 1b4474c9825453f20e986418fc0e9f05c1939dfa Mon Sep 17 00:00:00 2001 From: Wei-Sheng Chin Date: Tue, 5 Mar 2019 13:17:16 -0800 Subject: [PATCH 12/12] Address comments --- src/Microsoft.ML.FastTree/FastTreeArguments.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.ML.FastTree/FastTreeArguments.cs b/src/Microsoft.ML.FastTree/FastTreeArguments.cs index baead7aebc..6d2f2efded 100644 --- a/src/Microsoft.ML.FastTree/FastTreeArguments.cs +++ b/src/Microsoft.ML.FastTree/FastTreeArguments.cs @@ -273,7 +273,7 @@ internal override void Check(IExceptionContext ectx) #if OLD_DATALOAD ectx.CheckUserArg(0 <= secondaryMetricShare && secondaryMetricShare <= 1, "secondaryMetricShare", "secondaryMetricShare must be between 0 and 1."); #endif - ectx.CheckUserArg(0 < NdcgTruncationLevel, nameof(NdcgTruncationLevel), "lambdaMartMaxTruncation must be positive."); + ectx.CheckUserArg(0 < NdcgTruncationLevel, nameof(NdcgTruncationLevel), "must be positive."); } } } @@ -628,9 +628,10 @@ public enum OptimizationAlgorithmType { GradientDescent, AcceleratedGradientDesc /// /// Early stopping metrics. (For regression, 1: L1, 2:L2; for ranking, 1:NDCG@1, 3:NDCG@3). /// + [BestFriend] [Argument(ArgumentType.AtMostOnce, HelpText = "Early stopping metrics. (For regression, 1: L1, 2:L2; for ranking, 1:NDCG@1, 3:NDCG@3)", ShortName = "esmt")] [TGUI(Description = "Early stopping metrics. (For regression, 1: L1, 2:L2; for ranking, 1:NDCG@1, 3:NDCG@3)")] - public int EarlyStoppingMetrics; + internal int EarlyStoppingMetrics; /// /// Enable post-training pruning to avoid overfitting. (a validation set is required). @@ -732,24 +733,27 @@ public enum OptimizationAlgorithmType { GradientDescent, AcceleratedGradientDesc /// /// Freeform defining the scores that should be used as the baseline ranker. /// + [BestFriend] [Argument(ArgumentType.LastOccurenceWins, HelpText = "Freeform defining the scores that should be used as the baseline ranker", ShortName = "basescores", Hide = true)] [TGUI(NotGui = true)] - public string BaselineScoresFormula; + internal string BaselineScoresFormula; /// /// Baseline alpha for tradeoffs of risk (0 is normal training). /// + [BestFriend] [Argument(ArgumentType.LastOccurenceWins, HelpText = "Baseline alpha for tradeoffs of risk (0 is normal training)", ShortName = "basealpha", Hide = true)] [TGUI(NotGui = true)] - public string BaselineAlphaRisk; + internal string BaselineAlphaRisk; /// /// The discount freeform which specifies the per position discounts of examples in a query (uses a single variable P for position where P=0 is first position). /// + [BestFriend] [Argument(ArgumentType.LastOccurenceWins, HelpText = "The discount freeform which specifies the per position discounts of examples in a query (uses a single variable P for position where P=0 is first position)", ShortName = "pdff", Hide = true)] [TGUI(NotGui = true)] - public string PositionDiscountFreeform; + internal string PositionDiscountFreeform; #if !NO_STORE [Argument(ArgumentType.LastOccurenceWins, HelpText = "Offload feature bins to a file store", ShortName = "fbsopt", Hide = true)]