FastTreeBinaryTrainer Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The IEstimator<TTransformer> for training a decision tree binary classification model using FastTree.
public sealed class FastTreeBinaryTrainer : Microsoft.ML.Trainers.FastTree.BoostingFastTreeTrainerBase<Microsoft.ML.Trainers.FastTree.FastTreeBinaryTrainer.Options,Microsoft.ML.Data.BinaryPredictionTransformer<Microsoft.ML.Calibrators.CalibratedModelParametersBase<Microsoft.ML.Trainers.FastTree.FastTreeBinaryModelParameters,Microsoft.ML.Calibrators.PlattCalibrator>>,Microsoft.ML.Calibrators.CalibratedModelParametersBase<Microsoft.ML.Trainers.FastTree.FastTreeBinaryModelParameters,Microsoft.ML.Calibrators.PlattCalibrator>>
type FastTreeBinaryTrainer = class
inherit BoostingFastTreeTrainerBase<FastTreeBinaryTrainer.Options, BinaryPredictionTransformer<CalibratedModelParametersBase<FastTreeBinaryModelParameters, PlattCalibrator>>, CalibratedModelParametersBase<FastTreeBinaryModelParameters, PlattCalibrator>>
Public NotInheritable Class FastTreeBinaryTrainer
Inherits BoostingFastTreeTrainerBase(Of FastTreeBinaryTrainer.Options, BinaryPredictionTransformer(Of CalibratedModelParametersBase(Of FastTreeBinaryModelParameters, PlattCalibrator)), CalibratedModelParametersBase(Of FastTreeBinaryModelParameters, PlattCalibrator))
- Inheritance
Remarks
To create this trainer, use FastTree or FastTree(Options).
Input and Output Columns
The input label column data must be Boolean. The input features column data must be a known-sized vector of Single.
This trainer outputs the following columns:
Output Column Name | Column Type | Description | |
---|---|---|---|
Score |
Single | The unbounded score that was calculated by the model. | |
PredictedLabel |
Boolean | The predicted label, based on the sign of the score. A negative score maps to false and a positive score maps to true . |
|
Probability |
Single | The probability calculated by calibrating the score of having true as the label. Probability value is in range [0, 1]. |
Trainer Characteristics
Machine learning task | Binary classification |
Is normalization required? | No |
Is caching required? | No |
Required NuGet in addition to Microsoft.ML | Microsoft.ML.FastTree |
Exportable to ONNX | Yes |
Training Algorithm Details
FastTree is an efficient implementation of the MART gradient boosting algorithm. Gradient boosting is a machine learning technique for regression problems. It builds each regression tree in a step-wise fashion, using a predefined loss function to measure the error for each step and corrects for it in the next. So this prediction model is actually an ensemble of weaker prediction models. In regression problems, boosting builds a series of such trees in a step-wise fashion and then selects the optimal tree using an arbitrary differentiable loss function.
MART learns an ensemble of regression trees, which is a decision tree with scalar values in its leaves. A decision (or regression) tree is a binary tree-like flow chart, where at each interior node one decides which of the two child nodes to continue to based on one of the feature values from the input. At each leaf node, a value is returned. In the interior nodes, the decision is based on the test x <= v where x is the value of the feature in the input sample and v is one of the possible values of this feature. The functions that can be produced by a regression tree are all the piece-wise constant functions.
The ensemble of trees is produced by computing, in each step, a regression tree that approximates the gradient of the loss function, and adding it to the previous tree with coefficients that minimize the loss of the new tree. The output of the ensemble produced by MART on a given instance is the sum of the tree outputs.
- In case of a binary classification problem, the output is converted to a probability by using some form of calibration.
- In case of a regression problem, the output is the predicted value of the function.
- In case of a ranking problem, the instances are ordered by the output value of the ensemble.
For more information see:
- Wikipedia: Gradient boosting (Gradient tree boosting).
- Greedy function approximation: A gradient boosting machine.
Check the See Also section for links to examples of the usage.
Fields
FeatureColumn |
The feature column that the trainer expects. (Inherited from TrainerEstimatorBase<TTransformer,TModel>) |
GroupIdColumn |
The optional groupID column that the ranking trainers expects. (Inherited from TrainerEstimatorBaseWithGroupId<TTransformer,TModel>) |
LabelColumn |
The label column that the trainer expects. Can be |
WeightColumn |
The weight column that the trainer expects. Can be |
Properties
Info | (Inherited from FastTreeTrainerBase<TOptions,TTransformer,TModel>) |
Methods
Fit(IDataView, IDataView) |
Trains a FastTreeBinaryTrainer using both training and validation data, returns a BinaryPredictionTransformer<TModel>. |
Fit(IDataView) |
Trains and returns a ITransformer. (Inherited from TrainerEstimatorBase<TTransformer,TModel>) |
GetOutputSchema(SchemaShape) | (Inherited from TrainerEstimatorBase<TTransformer,TModel>) |
Extension Methods
AppendCacheCheckpoint<TTrans>(IEstimator<TTrans>, IHostEnvironment) |
Append a 'caching checkpoint' to the estimator chain. This will ensure that the downstream estimators will be trained against cached data. It is helpful to have a caching checkpoint before trainers that take multiple data passes. |
WithOnFitDelegate<TTransformer>(IEstimator<TTransformer>, Action<TTransformer>) |
Given an estimator, return a wrapping object that will call a delegate once Fit(IDataView) is called. It is often important for an estimator to return information about what was fit, which is why the Fit(IDataView) method returns a specifically typed object, rather than just a general ITransformer. However, at the same time, IEstimator<TTransformer> are often formed into pipelines with many objects, so we may need to build a chain of estimators via EstimatorChain<TLastTransformer> where the estimator for which we want to get the transformer is buried somewhere in this chain. For that scenario, we can through this method attach a delegate that will be called once fit is called. |