Skip to content

[tutorials] Drop sklearn dependency from RDataLoader Higgs tutorial - #23922

Merged
guitargeek merged 1 commit into
root-project:masterfrom
guitargeek:tutorials-higgs-classification-no-sklearn
Oct 30, 2026
Merged

guitargeek merged 1 commit into
root-project:masterfrom
guitargeek:tutorials-higgs-classification-no-sklearn

Conversation

@guitargeek

@guitargeek guitargeek commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Right now, the ml_dataloader_Higgs_Classification.py tutorial test is failing when sklearn is not installed.

The tutorial only used scikit-learn for roc_curve, which is a few lines of NumPy. Replace it with a small local helper that is equivalent to sklearn.metrics.roc_curve(..., drop_intermediate=False), so the tutorial can run without scikit-learn installed.

Also plot the full ROC curve: the previous code dropped the last point, i.e. the (1, 1) end of the curve.

Register the tutorial in the requires_numpy fixture list, since it now imports NumPy directly, and in requires_matplotlib, which it had always needed but never declared.

The alternative to this commit would have been to register the sklearn dependency in the tutorials/CMakeLists.txt, but reducing the test dependency on external Python packages is also a goal in itself.

Right now, the `ml_dataloader_Higgs_Classification.py` tutorial test is
failing when sklearn is not installed.

The tutorial only used scikit-learn for `roc_curve`, which is a few lines
of NumPy. Replace it with a small local helper that is equivalent to
`sklearn.metrics.roc_curve(..., drop_intermediate=False)`, so the
tutorial can run without scikit-learn installed.

Also plot the full ROC curve: the previous code dropped the last point,
i.e. the (1, 1) end of the curve.

Register the tutorial in the `requires_numpy` fixture list, since it now
imports NumPy directly, and in `requires_matplotlib`, which it had always
needed but never declared.

The alternative to this commit would have been to register the `sklearn`
dependency in the `tutorials/CMakeLists.txt`, but reducing the test
dependency on external Python packages is also a goal in itself.
@guitargeek
guitargeek force-pushed the tutorials-higgs-classification-no-sklearn branch from f5b8b9d to 9090254 Compare October 30, 2026 17:49
@guitargeek
guitargeek merged commit 6f7cb11 into root-project:master Oct 30, 2026
29 of 32 checks passed
@guitargeek
guitargeek deleted the tutorials-higgs-classification-no-sklearn branch October 30, 2026 21:00
@guitargeek

Copy link
Copy Markdown
Contributor Author

/backport to 6.40

@root-project-bot

Copy link
Copy Markdown

Preparing to backport PR #23922 to branch 6.40 requested by guitargeek

@root-project-bot

Copy link
Copy Markdown

Something went wrong with the creation of the PR to backport to 6.40: @guitargeek please see the logs

@guitargeek

Copy link
Copy Markdown
Contributor Author

/backport to 6.42

@root-project-bot

Copy link
Copy Markdown

Preparing to backport PR #23922 to branch 6.42 requested by guitargeek

@root-project-bot

Copy link
Copy Markdown

This PR has been backported to branch 6.42: #23929

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.

3 participants