Share via


FastTreeRankingTrainer Class

Definition

The IEstimator<TTransformer> for training a decision tree ranking model using FastTree.

public sealed class FastTreeRankingTrainer : Microsoft.ML.Trainers.FastTree.BoostingFastTreeTrainerBase<Microsoft.ML.Trainers.FastTree.FastTreeRankingTrainer.Options,Microsoft.ML.Data.RankingPredictionTransformer<Microsoft.ML.Trainers.FastTree.FastTreeRankingModelParameters>,Microsoft.ML.Trainers.FastTree.FastTreeRankingModelParameters>
type FastTreeRankingTrainer = class
    inherit BoostingFastTreeTrainerBase<FastTreeRankingTrainer.Options, RankingPredictionTransformer<FastTreeRankingModelParameters>, FastTreeRankingModelParameters>
Public NotInheritable Class FastTreeRankingTrainer
Inherits BoostingFastTreeTrainerBase(Of FastTreeRankingTrainer.Options, RankingPredictionTransformer(Of FastTreeRankingModelParameters), FastTreeRankingModelParameters)
Inheritance

Remarks

To create this trainer, use FastTree or FastTree(Options).

Input and Output Columns

The input label data type must be key type or Single. The value of the label determines relevance, where higher values indicate higher relevance. If the label is a key type, then the key index is the relevance value, where the smallest index is the least relevant. If the label is a Single, larger values indicate higher relevance. The feature column must be a known-sized vector of Single and input row group column must be key type.

This trainer outputs the following columns:

Output Column Name Column Type Description
Score Single The unbounded score that was calculated by the model to determine the prediction.

Trainer Characteristics

Machine learning task Ranking
Is normalization required? No
Is caching required? No
Required NuGet in addition to Microsoft.ML Microsoft.ML.FastTree
Exportable to ONNX No

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:

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 null, which indicates that label is not used for training.

(Inherited from TrainerEstimatorBase<TTransformer,TModel>)
WeightColumn

The weight column that the trainer expects. Can be null, which indicates that weight is not used for training.

(Inherited from TrainerEstimatorBase<TTransformer,TModel>)

Properties

Info (Inherited from FastTreeTrainerBase<TOptions,TTransformer,TModel>)

Methods

Fit(IDataView, IDataView)

Trains a FastTreeRankingTrainer using both training and validation data, returns a RankingPredictionTransformer<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.

Applies to

See also