From 7f67015c829ab8781876c83968a5920729e25d89 Mon Sep 17 00:00:00 2001 From: Scott Inglis Date: Thu, 21 Feb 2019 17:57:52 -0800 Subject: [PATCH] Removes the learning rate parameter from RandomForest as this parameter was not used by the base class. This fixes #2237 --- src/Microsoft.ML.FastTree/RandomForest.cs | 1 - .../RandomForestClassification.cs | 6 ++---- src/Microsoft.ML.FastTree/RandomForestRegression.cs | 6 ++---- src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs | 12 ++++-------- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/Microsoft.ML.FastTree/RandomForest.cs b/src/Microsoft.ML.FastTree/RandomForest.cs index 3b7659145d..73ac1e36d5 100644 --- a/src/Microsoft.ML.FastTree/RandomForest.cs +++ b/src/Microsoft.ML.FastTree/RandomForest.cs @@ -31,7 +31,6 @@ private protected RandomForestTrainerBase(IHostEnvironment env, int numLeaves, int numTrees, int minDatapointsInLeaves, - double learningRate, bool quantileEnabled = false) : base(env, label, featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves) { diff --git a/src/Microsoft.ML.FastTree/RandomForestClassification.cs b/src/Microsoft.ML.FastTree/RandomForestClassification.cs index c8be0b057f..7b23053393 100644 --- a/src/Microsoft.ML.FastTree/RandomForestClassification.cs +++ b/src/Microsoft.ML.FastTree/RandomForestClassification.cs @@ -143,16 +143,14 @@ public sealed class Options : FastForestOptionsBase /// 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 learning rate. 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, - double learningRate = Defaults.LearningRates) - : base(env, TrainerUtils.MakeBoolScalarLabel(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves, learningRate) + int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves) + : base(env, TrainerUtils.MakeBoolScalarLabel(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves) { Host.CheckNonEmpty(labelColumn, nameof(labelColumn)); Host.CheckNonEmpty(featureColumn, nameof(featureColumn)); diff --git a/src/Microsoft.ML.FastTree/RandomForestRegression.cs b/src/Microsoft.ML.FastTree/RandomForestRegression.cs index c38718a148..1387830ec6 100644 --- a/src/Microsoft.ML.FastTree/RandomForestRegression.cs +++ b/src/Microsoft.ML.FastTree/RandomForestRegression.cs @@ -271,16 +271,14 @@ public sealed class Options : FastForestOptionsBase /// 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 learning rate. 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, - double learningRate = Defaults.LearningRates) - : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves, learningRate) + int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves) + : base(env, TrainerUtils.MakeR4ScalarColumn(labelColumn), featureColumn, weightColumn, null, numLeaves, numTrees, minDatapointsInLeaves) { Host.CheckNonEmpty(labelColumn, nameof(labelColumn)); Host.CheckNonEmpty(featureColumn, nameof(featureColumn)); diff --git a/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs b/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs index f495baf6d4..e4b116aedb 100644 --- a/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs +++ b/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs @@ -257,19 +257,17 @@ public static FastTreeTweedieTrainer FastTreeTweedie(this RegressionCatalog.Regr /// 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 FastForestRegression FastForest(this RegressionCatalog.RegressionTrainers catalog, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, string weights = null, int numLeaves = Defaults.NumLeaves, int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves, - double learningRate = Defaults.LearningRates) + int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); - return new FastForestRegression(env, labelColumn, featureColumn, weights, numLeaves, numTrees, minDatapointsInLeaves, learningRate); + return new FastForestRegression(env, labelColumn, featureColumn, weights, numLeaves, numTrees, minDatapointsInLeaves); } /// @@ -297,19 +295,17 @@ public static FastForestRegression FastForest(this RegressionCatalog.RegressionT /// 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 FastForestClassification FastForest(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, string weights = null, int numLeaves = Defaults.NumLeaves, int numTrees = Defaults.NumTrees, - int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves, - double learningRate = Defaults.LearningRates) + int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); - return new FastForestClassification(env, labelColumn, featureColumn, weights,numLeaves, numTrees, minDatapointsInLeaves, learningRate); + return new FastForestClassification(env, labelColumn, featureColumn, weights,numLeaves, numTrees, minDatapointsInLeaves); } ///