-
Notifications
You must be signed in to change notification settings - Fork 1.4k
RooFit: Fix plotOn normalization for extended PDFs #19656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RooFit: Fix plotOn normalization for extended PDFs #19656
Conversation
|
I have figured out whats wrong with my pull request Not all pdfs are required to have extended pdfs so it would cause trouble there and also that some of the tests were having the wrong output so i will have to fix that too. I will do this in sometime. |
Test Results 21 files 21 suites 3d 9h 33m 55s ⏱️ For more details on these failures, see this check. Results for commit b0132b4. ♻️ This comment has been updated with latest results. |
Signed-off-by: JasMehta08 <jasmehta805@gmail.com>
ceca2bd to
b0132b4
Compare
|
i changed the code a to make sure to ask if the pdfs are extendable and then i ran most of the tests that i could that were failing in the tutorial tests and they passed so i think this should fix it. (also this is my first time contributing could help me understand how can i test all the CI tests locally if even possible to do so) |
|
@guitargeek i went through the failing tests log and have figured out that the problem is being solved which is causing the stress tests to fail when it is comparing to the expected answers. Can you take a look at my code and tell me if you feel that it is right according to you, so, that i can go ahead and change the tests which are present in the stress tests. |
|
Hi @guitargeek , I've pushed a new version of the code that I believe is a more robust fix for the CI failures. Could a maintainer please approve the workflows to run so I can verify the solution? Thank you! |
|
the CI tests are passing, the ones which did not pass are having error relating to, Failed to open the S3 connection: You must provide an auth secret. which i think was a error with the CI itself not with the bug fix could you please look into it @guitargeek Thank you! |
guitargeek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks a lot @JasMehta08! This solution is super clean and exactly what we needed!
Since root-project#19656, scaling the pdf to the expected number of events in the plot is the default behavior, because this is what makes sense when comparing predictions to data. Therefore, the explicit `ExpectedRelative` normalization flag can be removed.
Since root-project#19656, scaling the pdf to the expected number of events in the plot is the default behavior, because this is what makes sense when comparing predictions to data. Therefore, the explicit `ExpectedRelative` normalization flag can be removed.
This Pull Request:
Changes or fixes:
This PR fixes an issue where the
plotOnfunction incorrectly normalizes an extended PDF to the number of events in a dataset, rather than to its own predicted number of events. This behavior is misleading when the PDF's normalization is a key part of the model's prediction.The default logic in
RooAbsPdf::plotOnis modified to check if a PDF is extended by callingexpectedEvents(). If it is, the function now uses the PDF's prediction for normalization; otherwise, it retains the old behavior of scaling to the data for non-extended PDFs.Checklist:
Testing
I have verified this fix locally with several tests:
Reproducer Script: Confirmed that for an extended PDF, the plotted curve is now normalized to the PDF's
expectedEvents().RooGaussian, the plotted curve is still correctly scaled to the data.RelativeExpectedandNumEventnormalization overrides. The results are shown in the plot below, and all components behave as expected.Fixes #18929