Skip to content

Expose quantile regression objective and alpha in LightGbmRegressionTrainer (Resolves #7603)#7605

Open
Sam7 wants to merge 2 commits intodotnet:mainfrom
Sam7:feature/issue-7603
Open

Expose quantile regression objective and alpha in LightGbmRegressionTrainer (Resolves #7603)#7605
Sam7 wants to merge 2 commits intodotnet:mainfrom
Sam7:feature/issue-7603

Conversation

@Sam7
Copy link
Copy Markdown

@Sam7 Sam7 commented Apr 14, 2026

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!

@Sam7
Copy link
Copy Markdown
Author

Sam7 commented Apr 14, 2026

@dotnet-policy-service agree

@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 (ff7b79c).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7605   +/-   ##
=======================================
  Coverage   69.60%   69.60%           
=======================================
  Files        1484     1484           
  Lines      273604   273696   +92     
  Branches    27948    27951    +3     
=======================================
+ Hits       190433   190501   +68     
- Misses      75813    75837   +24     
  Partials     7358     7358           
Flag Coverage Δ
Debug 69.60% <100.00%> (+<0.01%) ⬆️
production 63.84% <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.

@Sam7 Sam7 changed the title Add Alpha parameter to LightGbmRegressionTrainer for Quantile Regression (Resolves #7603) Expose quantile regression objective and alpha in LightGbmRegressionTrainer (Resolves #7603) Apr 14, 2026
@Sam7
Copy link
Copy Markdown
Author

Sam7 commented Apr 14, 2026

The failing CI appears to be unrelated to this PR. The error in Helix is Microsoft.ML.Tests.TrainerEstimators.TrainerEstimators.SdcaLogisticRegression on osx.15.arm64.open, whereas this PR only changes the LightGBM regression trainer/options/tests.
(I don't seem to have permission to rerun failed jobs in ADO)

Happy to make any adjustments if needed, but this looks like an unrelated test failure or flaky CI issue.

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

1 participant