-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix bug in Grid::convolute_eko
#182
Conversation
@felixhekhorn can you test on your example? |
Codecov Report
@@ Coverage Diff @@
## master #182 +/- ##
==========================================
+ Coverage 89.32% 89.33% +0.01%
==========================================
Files 47 47
Lines 6932 6930 -2
==========================================
- Hits 6192 6191 -1
+ Misses 740 739 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
With this branch I get
which seems to catch the problem - we're back at permille accuracy! I suggest, @andreab1997, you can recompute (whenever you have time, of course) the problematic grids in NNPDF/pineko#62 and confirm or deny the conclusion I also can partly confirm another comment of @andreab1997: this took ~2h to compute which he observed for the good commits as well (in contrast to "short runs" which resulted in wrong FK tables) |
Ok very good, thank you very much for this. As soon as I have time I will run a lot of tests to really be sure, but I would say that most likely we found the issue. |
@cschwan can we maybe consider an optimization for the grid, in which we reinterpolate all the subgrids on a common xgrid? For sure this will bring some loss in accuracy, but might be an acceptable one (against a considerable speed-up). |
@andreab1997 @felixhekhorn as a guiding principle: all grids converted from APPLgrids are potentially affected by this bug, grids generated from |
As far as I understand this won't help (yet), |
The idea would be to trash this PR and rely on the assumptions that they are all the same. According to @felixhekhorn
so this bug fix is heavily affecting performances. If we can live without, so much the better. |
This I don't understand: why wouldn't we want to merge this pull request?
I can always write a program that calculates the wrong results very quickly, but that isn't very helpful, of course. |
hm? if they are coming from the outside (meaning APPL) there is not much we can do, can we? reinterpolate is an option, but not the short term answer |
I am computing now all the fktables that are listed in "Things to check" in NNPDF/pineko#62 with this branch and I am ticking its elements one by one as I check them. For the moment the three that I have computed are fine so I believe also the others will be fine as well. Thank you again! |
Of course, we want correct results, but we want also to be fast. That's why I proposed reinterpolation: if we can transform subgrids, such that they all have a common x, we will loose a bit in precision, but for a great gain in performances. |
fwiw the more I think about it the more I am convinced that what we want at the fit level is a common x grid. The fitting problem becomes a lot easier to reason about then. Measuring how fine the grid needs to be is relatively easy. |
I believe we all agree, that is definitely a good thing. But it is about the xgrid in the FkTable, that is coming from the EKO output, and it is already guaranteed. Here we are talking of the EKO input ( By the way @cschwan, I believe that the current status (this PR) might also be wrong: if subgrid A has a different xgrid than subgrid B, in order to use a single EKO we have to compute it on the union (since we are not reinterpolating it on the fly). |
@alecandido I think what you're probably doing is to calculate the EKO for each bin (the x grids don't change over luminosities and there's only one order) and then merge all EKOs. I think in this case there shouldn't be a problem, since most likely the x grids for each bin are all pairwise disjoint sets. If this isn't the case, merging EKOs for different bins should fail. In other words there's probably no problem. |
Don't think so, since we rely on grid information to construct the EKO, in particular on
So, given a grid, PineAPPL is always returning us a single xgrid, not a bin-dependent one. |
And here is the proof that we are computing the EKO for the union xgrid: The key is, of course, |
I don't believe this is a problem, because we're already at the level of matrix multiplication (after the grid), so the interpolation only plays a role inside the grid. Afterwards, it is just linear algebra: meaning eko is exact on the grid points (by construction) and so the information from the input to any output point is exact |
Let's say you have a grid with two bins for DIS. The first bin has this x grid:
and the second bin:
which means you calculate the EKO for the union of the x grid points given above. For the first bin that means the evolution is done using the a subset (the first set), while the other x grid points contribute with zero. I don't see anything wrong with that; the interpolation should still work. |
One of the two is exact, this is true: matrix multiplication is always a contraction over two paired, but different, indices:
This only works if the index over the EKO is of kind 1., can you convince me of this? @felixhekhorn |
@cschwan the problem is there for one of the EKO indices (input or output, it is always confusing to me). |
@alecandido if we use
we should be able to see what happens and how big the difference is. |
Sorry to step into the discussion but I just wanted to add a detail. It seems that for the fktables in the list "Things with a conjectured solution" the conjectured solution was wrong because with this branch I got the correct result. |
@andreab1997 so if I understand you then in every case you've seen so far the differences between the grids and the corresponding FK tables are small? That would be reassuring. |
Let me think one moment, and let's wait for @felixhekhorn reply. In any case, I don't believe the exercise to be extremely relevant: either it is correct, or it is wrong. |
@alecandido we had a similar discussion here: #151. |
Yes exactly, most of the times under the permille level. Sometimes the error is slightly above 1 permille but never more than that. |
In that case, we were considering different grids. Now the problem is within a single grid. |
If in all cases we've seen so far the differences are small then I believe - which is a rather weak statement, I admit - the interpolation can't be too far off and at the very least we probably don't have to hold off producing fits with the new pipeline. In any case I agree we should thoroughly test it and being correct is paramount! |
Since we are now pretty sure that this was the source of the bug, @cschwan are you going to release a new version? Or do you want to wait to improve performances first? For me it makes essentially no difference (although it is obviuosly simpler with a release). |
@andreab1997 I'll probably release a new version at the end of today. @alecandido @felixhekhorn given that we fixed the initial problem, are you OK with merging this pull request? |
Yes, let's merge this one, and go back to the former status. We can keep discussing about the rest separately. |
@andreab1997 I've just released |
Ok thank you very much! |
I reverted b7014fd, as @cschwan suspect this to be the issue #103 (comment).