Skip to content
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

Return all members when using MC PDFs #1522

Merged
merged 13 commits into from
Mar 9, 2022
Merged

Conversation

scarlehoff
Copy link
Member

As the title suggest.

After the two previous PR (#1515 and #1517) where Stats where used everywhere, the only two things that are problematic are:

  1. The sumrules (I guess nobody cared whether the central value was computed because by definition it would fall inside the envelope anyway?)
  2. The N3PDF interface (which was a hack to be compatible with what vp was doing, so now the hack has to be undone).

Nothing is evidently broken, but many thing might be broken in not obvious ways. The first commit is just so that the regression for the sumrules passes so I can update it in the next commit (where all members will be computed also there for both Hessian and MC PDFs).

The last commit will be a simplification of the N3PDF interface to validphys. And that should be all.

After all this series of PR nothing should be accessing libNNPDF results any longer other than the commondata datapoints which are immediately wrapped into a Stats class:

self._central_value = dataobj.get_cv()

but loading them in python is the next step: #1511 :)

(ofc, this last one is not necessary to destroy C++ but since we were already here we might as well do it, if you guys prefer to keep doing MC pdfs as we were doing up to know please let me know asap so I don't build on top of this PR)

@scarlehoff scarlehoff force-pushed the mc_pdf_to_include_all branch from 21e4fea to 0321658 Compare February 15, 2022 15:39
@scarlehoff scarlehoff added the run-fit-bot Starts fit bot from a PR. label Feb 15, 2022
@scarlehoff scarlehoff force-pushed the mc_pdf_to_include_all branch from 80b8d4c to c5425ff Compare February 16, 2022 14:43
@scarlehoff scarlehoff added run-fit-bot Starts fit bot from a PR. and removed run-fit-bot Starts fit bot from a PR. labels Feb 16, 2022
@github-actions
Copy link

Greetings from your nice fit 🤖 !
I have good news for you, I just finished my tasks:

Check the report carefully, and please buy me a ☕ , or better, a GPU 😉!

@scarlehoff
Copy link
Member Author

almost there

@scarlehoff scarlehoff added run-fit-bot Starts fit bot from a PR. and removed run-fit-bot Starts fit bot from a PR. labels Feb 17, 2022
@scarlehoff scarlehoff marked this pull request as ready for review February 17, 2022 09:01
@scarlehoff
Copy link
Member Author

scarlehoff commented Feb 17, 2022

This should be ready for review. We can talk this afternoon about who is going to review this because I guess all three PR should be done by the same person and hopefully at the same time.

I've run all the examples in the validphys folder with the current commit. I can gzip them all and send them to the reviewer if they wish.

The fit bot can be run when we get the extra space.

@scarlehoff scarlehoff removed the run-fit-bot Starts fit bot from a PR. label Feb 17, 2022
Copy link
Contributor

@Zaharid Zaharid left a comment

Choose a reason for hiding this comment

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

Will take me a while to go over the bits.

n3fit/src/n3fit/vpinterface.py Show resolved Hide resolved
n3fit/src/n3fit/vpinterface.py Show resolved Hide resolved
n3fit/src/n3fit/vpinterface.py Outdated Show resolved Hide resolved
Co-authored-by: Zaharid <zk261@cam.ac.uk>
@scarlehoff
Copy link
Member Author

scarlehoff commented Feb 25, 2022

TODO:

  • Access the arrays directly in correlations.py comment
  • Check whether copy_grid in XplottingGrid can be made to only accept Stats without breaking anything comment
  • Either remove mask_replicas completely or make it part of the Stats class comment

As discussed, moving here the minor comments of the other PRs so that they can be merged

@Zaharid
Copy link
Contributor

Zaharid commented Feb 25, 2022

@scarlehoff do you want to merge the other PR as they are and keep working here, or close the others and only merge this one?

@scarlehoff
Copy link
Member Author

@scarlehoff do you want to merge the other PR as they are and keep working here, or close the others and only merge this one?

Maybe merging them one by one makes doing the "undo" easier in case something is wrong obviously with any of them. But I don't think it makes a difference tbh

@Zaharid
Copy link
Contributor

Zaharid commented Feb 25, 2022

TBH I find looking at the diff here a bit confusing, so if we could merge the others and rebase possible further changes here, I'd be happier.

@scarlehoff
Copy link
Member Author

if you approve the others I'll merge them

Base automatically changed from utilize_error_members_instead_of_rawdata to master March 1, 2022 11:24
@scarlehoff
Copy link
Member Author

I've implemented now the changes that were requested on the other two PRs.

@Zaharid Zaharid requested a review from RoyStegeman March 2, 2022 15:49
Copy link
Member

@RoyStegeman RoyStegeman left a comment

Choose a reason for hiding this comment

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

This seems alright. The diffs are a real mess though..

n3fit/src/n3fit/vpinterface.py Outdated Show resolved Hide resolved
n3fit/src/n3fit/vpinterface.py Show resolved Hide resolved
n3fit/src/n3fit/io/writer.py Outdated Show resolved Hide resolved
validphys2/src/validphys/sumrules.py Outdated Show resolved Hide resolved
validphys2/src/validphys/core.py Outdated Show resolved Hide resolved
validphys2/src/validphys/correlations.py Show resolved Hide resolved
Co-authored-by: Roy Stegeman <roystegeman@live.nl>
@scarlehoff
Copy link
Member Author

This seems alright. The diffs are a real mess though..

You are going to hate me so much when you're made to review #1529...

@scarlehoff
Copy link
Member Author

I think I addressed everything.

Copy link
Member

@RoyStegeman RoyStegeman left a comment

Choose a reason for hiding this comment

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

Thanks. This looks good!

@scarlehoff
Copy link
Member Author

@Zaharid are you happy merging this? (it's currently blocked by you)

@@ -547,8 +547,7 @@ def phi_data(abs_chi2_data):
1410.8849
"""
alldata, central, npoints = abs_chi2_data
cv = float(alldata.central_value())
return (np.sqrt((cv - central) / npoints), npoints)
return (np.sqrt((alldata.error_members().mean() - central) / npoints), npoints)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should make this and abs_chi2_data Stats as well, but that is another PR.

Copy link
Contributor

@Zaharid Zaharid left a comment

Choose a reason for hiding this comment

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

If Roy is happy I am happy.

Co-authored-by: Zaharid <zk261@cam.ac.uk>
@scarlehoff scarlehoff merged commit 53a145f into master Mar 9, 2022
@scarlehoff scarlehoff deleted the mc_pdf_to_include_all branch March 9, 2022 14:11
@Zaharid Zaharid added the enhancement New feature or request label May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
destroyingc++ enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants