Add demo test for multioutput_reduced_gradient.py - #12397
Open
Nityahapani wants to merge 1 commit into
Open
Conversation
test_demos.py runs most demo scripts as a real subprocess smoke test. multioutput_reduced_gradient.py had no coverage; this is the only thing exercising xgboost.objective.TreeObjective at all (grepped tests/python/*.py for both the script name and TreeObjective directly -- zero hits either way), so this is genuinely the sole safety net for that experimental feature, not just a routine smoke test. Verified this is a real gap and not another false positive like my earlier mistake with prediction_intervals.py: re-ran the demo-vs-test comparison from scratch on a clean master checkout with a more robust grep pattern, and separately grepped the test file directly for both the script's filename and its actual class names (TreeObjective, LsObjMean, LsObjSvd) to be sure. Runs with the script's default `--device cpu` (no args needed). Its three `import cupy` statements are all inside `else` branches gated on `self.device == "cpu"` checks (confirmed by reading each one's surrounding context directly), so none of them execute on this path -- no cupy/GPU dependency for this test. `no_sklearn()` skip marker matches every other sklearn-dependent test in this file (the script uses sklearn.datasets.make_regression, sklearn.base.BaseEstimator, and sklearn.decomposition.TruncatedSVD, all part of core scikit-learn, no extra dependency).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add demo test for multioutput_reduced_gradient.py
Summary
test_demos.pyruns most demo scripts as a real subprocess smoke test.multioutput_reduced_gradient.pyhad no coverage. This is genuinely theonly thing exercising
xgboost.objective.TreeObjectiveat all (greppedtests/python/*.pyfor both the script name andTreeObjectivedirectly —zero hits either way), so this is the sole safety net for that experimental
feature, not just a routine smoke test.
Change
Verification
--device cpu(no args needed)import cupystatements are all insideelsebranches gated onself.device == "cpu"checks — confirmed by reading each one'ssurrounding context directly — so none of them execute on this path, no
cupy/GPU dependency for this test
no_sklearn()skip marker matches every other sklearn-dependent test inthis file (the script uses
sklearn.datasets.make_regression,sklearn.base.BaseEstimator, andsklearn.decomposition.TruncatedSVD,all part of core scikit-learn, no extra dependency)
I also checked the other 8 demo scripts currently missing test coverage
(
cat_in_the_dat.py,cover_type.py,gamma_regression.py,gpu_tree_shap.py,learning_to_rank.py,quantile_data_iterator.py,spark_estimator_examples.py,update_process.py) and confirmed each iscorrectly excluded for a real reason (local-only data files, GPU/RAPIDS
dependencies, a large external ranking dataset, or pyspark) — not further
oversights, so this PR is scoped to just the one genuine gap.