Skip to content

Add Quantile Regression support to LightGbmRegressionTrainer #7603

@ssperling-wmp

Description

@ssperling-wmp

Summary

The underlying LightGBM C++ framework natively supports quantile regression via the parameters objective="quantile" and alpha=<float> (where alpha is the target quantile, e.g., 0.05 for the 5th percentile). However, the ML.NET LightGbmRegressionTrainer wrapper currently hardcodes objective="regression" in LightGbmRegressionTrainer.cs and does not expose the alpha parameter, making it impossible to train quantile regression models through the ML.NET API.

Motivation

Quantile regression is widely used for:

  • Prediction intervals: Training two models (e.g., α=0.05 and α=0.95) to obtain a 90% prediction interval
  • Risk modeling: Predicting worst/best-case scenarios
  • Heteroscedastic data: Where variance changes across the feature space

Since the native LightGBM library already supports this, exposing it through ML.NET would be a high-value, low-risk enhancement.

Proposed Changes

  1. Add a RegressionObjective enum to LightGbmRegressionTrainer.Options with values Regression (default) and Quantile
  2. Add an Alpha property (double, default 0.5) to LightGbmRegressionTrainer.Options
  3. Modify CheckAndUpdateParametersBeforeTraining to conditionally set objective=quantile and alpha=<value>
  4. Validate that Alpha ∈ (0, 1)
  5. Add unit tests

API Usage

var options = new LightGbmRegressionTrainer.Options
{
    Objective = LightGbmRegressionTrainer.Options.RegressionObjective.Quantile,
    Alpha = 0.95,
};
var trainer = mlContext.Regression.Trainers.LightGbm(options);

Scope

  • No new trainer class, quantile regression produces identical tree structures and output schema
  • No changes to model serialization, ONNX export, or catalog extension methods

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestuntriagedNew issue has not been triaged

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions