LightGbmRankingTrainer Class


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

public sealed class LightGbmRankingTrainer : Microsoft.ML.Trainers.LightGbm.LightGbmTrainerBase<Microsoft.ML.Trainers.LightGbm.LightGbmRankingTrainer.Options,float,Microsoft.ML.Data.RankingPredictionTransformer<Microsoft.ML.Trainers.LightGbm.LightGbmRankingModelParameters>,Microsoft.ML.Trainers.LightGbm.LightGbmRankingModelParameters>
type LightGbmRankingTrainer = class
    inherit LightGbmTrainerBase<LightGbmRankingTrainer.Options, single, RankingPredictionTransformer<LightGbmRankingModelParameters>, LightGbmRankingModelParameters>
Public NotInheritable Class LightGbmRankingTrainer
Inherits LightGbmTrainerBase(Of LightGbmRankingTrainer.Options, Single, RankingPredictionTransformer(Of LightGbmRankingModelParameters), LightGbmRankingModelParameters)


To create this trainer, use LightGbm or LightGbm(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.LightGbm

Training Algorithm Details

LightGBM is an open source implementation of gradient boosting decision tree. For implementation details, please see LightGBM's official documentation or this paper.

Check the See Also section for links to examples of the usage.



The feature column that the trainer expects.

(Inherited from TrainerEstimatorBase<TTransformer,TModel>)

The optional groupID column that the ranking trainers expects.

(Inherited from TrainerEstimatorBaseWithGroupId<TTransformer,TModel>)

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

(Inherited from TrainerEstimatorBase<TTransformer,TModel>)

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

(Inherited from TrainerEstimatorBase<TTransformer,TModel>)


Info (Inherited from LightGbmTrainerBase<TOptions,TOutput,TTransformer,TModel>)



Trains and returns a ITransformer.

(Inherited from TrainerEstimatorBase<TTransformer,TModel>)
Fit(IDataView, IDataView)

Trains a LightGbmRankingTrainer using both training and validation data, returns a RankingPredictionTransformer<TModel>.

GetOutputSchema(SchemaShape) (Inherited from TrainerEstimatorBase<TTransformer,TModel>)

Extension Methods

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