Skip to content

Add Alpha parameter to LightGbmRegressionTrainer for Quantile Regression (Resolves #7603)#7604

Closed
ssperling-wmp wants to merge 2 commits intodotnet:mainfrom
ssperling-wmp:feature/issue-7603
Closed

Add Alpha parameter to LightGbmRegressionTrainer for Quantile Regression (Resolves #7603)#7604
ssperling-wmp wants to merge 2 commits intodotnet:mainfrom
ssperling-wmp:feature/issue-7603

Conversation

@ssperling-wmp
Copy link
Copy Markdown

Description

This PR exposes the Alpha parameter in LightGbmRegressionTrainer.Options, bringing the ML.NET LightGBM wrapper into parity with the native C++ LightGBM library for Quantile Regression.

Resolves #7603

Background & Motivation

Currently, ML.NET users cannot perform native Quantile Regression (predicting the 5th or 95th percentiles instead of the mean) because the underlying LightGBM alpha parameter is hidden. This addition allows users to set Alpha directly in the options, unlocking probabilistic bounding and percentile estimation for regression tasks without needing to leave the native C# ML.NET ecosystem.

Changes Made

  • Added public double? Alpha { get; set; } to LightGbmRegressionTrainer.Options (and mapped it to the LightGbmArguments).
  • Ensured the parameter marshals correctly down to the native LightGBM C++ booster dictionary.
  • Added/Updated unit tests to verify that Alpha is successfully passed through when specified.

API Impact & Safety

This is a strictly additive API change. The default behavior for standard L2 (Mean Squared Error) regression remains completely unaffected. If Alpha is not explicitly provided by the user, the trainer behaves exactly as it did before.

cc @michaelgsharp @luisquintanilla — Tagging you for visibility on the API addition! Since this exposes existing native C++ functionality and doesn't break default behavior, I'm hoping it's a smooth API review. Let me know if you need any adjustments to the tests or parameter mapping!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds quantile regression support to the ML.NET LightGBM regression trainer by introducing a selectable regression objective and exposing the LightGBM alpha (quantile) parameter through LightGbmRegressionTrainer.Options.

Changes:

  • Added RegressionObjective (Regression vs Quantile) and Alpha option to LightGbmRegressionTrainer.Options.
  • Updated parameter wiring to set LightGBM objective=quantile and alpha=<value> when quantile mode is selected.
  • Added unit tests for quantile training, prediction behavior, and invalid alpha validation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
src/Microsoft.ML.LightGbm/LightGbmRegressionTrainer.cs Adds Objective/Alpha options and maps them to LightGBM parameters during training.
test/Microsoft.ML.Tests/TrainerEstimators/TreeEstimators.cs Adds new LightGBM quantile regression tests (estimator, ordering, and invalid alpha).

@github-actions github-actions bot mentioned this pull request Apr 14, 2026
9 tasks
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.60%. Comparing base (9d809f1) to head (205814e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7604   +/-   ##
=======================================
  Coverage   69.60%   69.60%           
=======================================
  Files        1484     1484           
  Lines      273604   273696   +92     
  Branches    27948    27951    +3     
=======================================
+ Hits       190433   190513   +80     
- Misses      75813    75820    +7     
- Partials     7358     7363    +5     
Flag Coverage Δ
Debug 69.60% <100.00%> (+<0.01%) ⬆️
production 63.85% <100.00%> (-0.01%) ⬇️
test 89.64% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...Microsoft.ML.LightGbm/LightGbmRegressionTrainer.cs 80.80% <100.00%> (+2.22%) ⬆️
...osoft.ML.Tests/TrainerEstimators/TreeEstimators.cs 98.06% <100.00%> (+0.21%) ⬆️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Quantile Regression support to LightGbmRegressionTrainer

2 participants