Group datasets by experiment PLOTTING label#427
Conversation
There was a problem hiding this comment.
urm probably I can do this better I was rushing to get it to work but I noticed that at the moment one cannot set use_theorycovmat: False since it isn't handled in logic
There was a problem hiding this comment.
We should rethink the whole thing.
There was a problem hiding this comment.
A great addition to reportengine.Config would be something that performs these two lines by itself.
There was a problem hiding this comment.
We should rethink the whole thing.
There was a problem hiding this comment.
This needs to have the new behaviour documented.
|
I think we should move towards having (data, theory predictions, covmat) -> chi2 instead of (results) -> chi2. Now covmat requires way too many switches (and mixing data and theory in DataSet has always been a big problem in libnnpdf). |
|
@scarrazza @tgiani while I am unhappy with vp getting a lot uglier due to this whole covmat thing I don't see much to do here short of rewriting the whole thing (which we should be doing by now). Please do look and test this. |
|
@wilsonmr Please rebase on top of master and force push to get the tests to work. Would be good to add tests with the theory covmat. I am also thinking that if we are going to use a theory covmat everywhere, it should be computed by vp rather than loaded somewhere with potentially incompatible data. And in the case where it is loaded, we should be able to check that e.g. the cuts match. One way to go about that is storing the corresponding namespace information on the cuts, in line with #224. |
|
In any case we need a plan on how this should look like medium term. |
|
sure, the loading is a bit problematic. The only possible problem is if it is to be computed then basically every report from now on will require up to 9 theories to run. Like you say, at the very least the loaded one should check that it's consistent with the cuts. There is still more to do with this if it is the direction you want to go for now - this will break the total chi2 values everywhere because they will miss theory correlations between experiments (as defined in this branch) |
a76ec5a to
3af0be9
Compare
Last Commit:Ok some decisions made here:
Finally here is a new (compare to its old version https://vp.nnpdf.science/WfioqoYSSl2DCFyr1xgEsw==/#chi2-by-experiment the datasets are sometimes ordered differently but they seem to have same numbers, less/no To do: (provided this passes tests)
|
|
Can we add to vp-comparefits some info on what covmat is used for the various plots? This could be a piece of text after the title or some label in the plot. |
|
I can, but they should be the same in this case, just in a different order since the |
|
Yeah, sorry just realized. |
|
oh also I'm very bad at thinking of proper variable names, so probably these need to be changed <- input appreciated |
|
Yeah, I am not a fan of the name |
|
Specifically I don't think the names should contain references to |
|
I just wanted to have some kind of distinction between these experiments and the fitted experiment, the latter of which has some kind of meaningful bearing on the total chi2. I guess I need to change the tests to account for the new DataResult layout. I didn't quite do what you said wrt |
|
As soon as #356 becomes a thing then this becomes less confusing, perhaps it would be sufficient to call the new providers and delete for example |
3af0be9 to
85fbe06
Compare
|
So this is a bit cleaner and at least some of the tests are running now, however they're also giving the wrong numbers, which I'm really confused by because the method shouldn't have been changed. I will have to look at this later as I'm away this weekend |
|
OK I was being an idiot and didn't allow for using t0set in |
|
@wilsonmr what is the status here? Should this be reviewed? |
|
I think there's a couple of things to do first. I will take a look now |
|
Ok I updated the report above with a new label to say if theory covmat was used (https://vp.nnpdf.science/T9J7ouncRqK8WJY4avGGmA==) is this ok? I went for the 'exp + th' label since it appears in the legends of the relevant plots and columns of tables now and I didn't want to make the strings unneccesarily long |
|
It's fine, but I think we should have this info somewhere in the report in text form. |
|
Ok I'll also add that |
I don't think we decided anything in particular. I'd say for now let's put it in the guide, as it is currently more helpful for users and the added cost of moving it later is negligible. |
Well the errorbar of the theory predictions should be the same - it's just the spread of replicas, the issue is: in the two namespaces the data actually have different errorbars and so probably this needs a slight rethink |
|
Ah, right.
…On Fri, 26 Apr 2019, 15:25 wilsonmr, ***@***.***> wrote:
If I do something like this:
dataset_input: {dataset: HERAF2CHARM}
dataspecs:
- use_thcovmat_if_present: True
- use_thcovmat_if_present: False
normalize_to: 0
use_cuts: "fromfit"
fit: 190310-tg-nlo-global-7pts
pdf:
from_: fit
theory:
from_: fit
theoryid:
from_: theory
template_text: | ***@***.***_fancy_dataspecs@} ***@***.*** dataset_chi2_table@}actions_:
- report(main=True)
I see different values in the tables, but exactly the same error bars in
the plots. Any idea why?
Well the errorbar of the theory predictions should be the same - it's just
the spread of replicas, the issue is:
#For now, simply take the first data result. We'll need to improve this.
results = [dataspecs_results[0][0], *[r[1] for r in dataspecs_results]]
in the two namespaces the data actually have different errorbars and so
probably this needs a slight rethink
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#427 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABLJWUTBEMPD63OXKWXAOJTPSL7FRANCNFSM4HE7HX7A>
.
|
|
Can we make |
…ble names, outputs either None or a ThCovMatSpec
|
Ok I made the changes and added documentation. Could somebody double check the documentation? I think I got the flags right for running fits based upon https://www.wiki.ed.ac.uk/download/attachments/58984316/Theory_covariance_module_documentation.pdf?version=1&modificationDate=1553184077000&api=v2 however the 7 points stuff wasn't entirely clear to me @voisey I haven't checked if the second to last commit broke anything because my laptop is a bit full right now and I wanted to make sure that |
|
ugh there were a few things broken, just sorting it out |
|
Before last commit the Now the config production rule reads a bit clearer I think - unfortunately the logic still has to be a bit ugly to handle all cases. |
| dest='thcovmat_if_present', | ||
| action='store_false', | ||
| help="Do not use theory cov mat for calculating statistical estimators.") | ||
| parser.set_defaults(thcovmat_if_present=None) |
There was a problem hiding this comment.
User must specify to use or not on command line (or use interactive)
(before I had something that was like --th_covmat <True/False> but argparse reads it as string, this is probs best way to handle a boolean)
Also the default value being True or False doesn't play nicely with interactive mode
There was a problem hiding this comment.
I am fine with not having a default for now. It is the kind of thing that people in the future will say is obvious one way or another, but it is difficult to say which way.
| argnames = ( | ||
| 'base_fit', 'reference_fit', 'title', 'author', 'keywords') | ||
| boolnames = ( | ||
| 'thcovmat_if_present',) |
There was a problem hiding this comment.
this is a bit dirty and looks redundant at the moment but I figured that perhaps we might want more booleans that can also be used with the interactive mode in the future and it makes it easy to see what's happening
I've just read through the documentation and it looks good to me. I haven't tested the flags but the 7-points stuff looks correct to me. |
|
awesome, thanks |
|
Should I look at this then? |
|
Yes please |
|
|
||
| ##### 3-point | ||
|
|
||
| ``` |
There was a problem hiding this comment.
Please use ```yaml for runcard examples.
|
@Zaharid asides from the documentation which I can fix shortly, had you managed to look at the other files.. In particular I think you might be able to see a better way of going about the |
|
|
||
| Once the user has correctly specified the `theoryids` and additional flags for their chosen | ||
| prescription then the user must specify which PDF will be used to generate the theory 'points' required | ||
| to construct the theory covariance matrix. The user must additionally specify where the theory covariance is to be used. The theory |
There was a problem hiding this comment.
Please format the text to be 80 characters per line.
There was a problem hiding this comment.
done, I thought 100 was fine nowadays? Either way I think some of the lines were well over.
|
|
||
| --------------------------------------------------------------------- | ||
|
|
||
| ##### 3-point |
There was a problem hiding this comment.
We definitively need to make it so that this information is stored somewhere and one does not need to duplicate it all the time.
| `use_thcovmat_if_present: True` must have been fitted in the corresponding `fit`. If the | ||
| corresponding fit has `use_thcovmat_if_present: False` then the user will be warned and there will | ||
| be no contribution from the theory covariance matrix used in calculating statistical estimators for | ||
| that runcard. |
There was a problem hiding this comment.
This seems like it should be an error, not a warning.
There was a problem hiding this comment.
This behaviour makes all of the reports which compare fit with theory uncertainties to baseline fit possible. I don't think this should be an error especially since the flag is *_if_present.
Now the warning I think is fine however I noticed that for some fits the error gets printed loads of times (perhaps because I was in parallel mode?) is this expected? It seems unneccessary to have the warning appear like 30 times..
| be no contribution from the theory covariance matrix used in calculating statistical estimators for | ||
| that runcard. | ||
|
|
||
| Finally, the `use_thcovmat_if_present` flag can be specified at runtime when using the |
There was a problem hiding this comment.
I am not sure what "at runtime" means here.
| must manually set `use_thcovmat_if_present` to be False, or provide an appropriate fit. | ||
| theory covariance matrix then returns `False`. | ||
| """ | ||
| if not isinstance(use_thcovmat_if_present, bool): |
There was a problem hiding this comment.
I think this is unreachable because you already specify the type in the function signature.
There was a problem hiding this comment.
I appear to be able to reach it
There was a problem hiding this comment.
Ah, indeed. I thought I had done about this than open an issue:
| """ | ||
| return label | ||
|
|
||
| def produce_experiments_from_plotting(self, fit): |
There was a problem hiding this comment.
I think this should be called something else. If it wasn't so late I would think about a better name... The main issue is that it is unclear what the input is from the name, and I would never have guessed that it is a fit.
|
|
||
| return df | ||
|
|
||
| #TODO: Add check here that dataset appears in fitthcovmat (if true) and that cuts match |
There was a problem hiding this comment.
Don't we have a check that the cuts match below (it is not very good in that it doesn't actually look at the points but only at the totals, but...)
There was a problem hiding this comment.
Yes, actually I think I meant to delete this
| dest='thcovmat_if_present', | ||
| action='store_false', | ||
| help="Do not use theory cov mat for calculating statistical estimators.") | ||
| parser.set_defaults(thcovmat_if_present=None) |
There was a problem hiding this comment.
I am fine with not having a default for now. It is the kind of thing that people in the future will say is obvious one way or another, but it is difficult to say which way.
|
Sorry this took a while but it has been a long week. I now more or less seem the logic and find it ok given what we have. But it does add many things that have to be improved later. |
|
so I renamed the production rules to be like |
|
Thanks for figuring out all the non trivial changes! |
closes #413, closes #418
closes #174 (the dataspecs plots already exists)
At the moment this is EXTREMELY basic, but it explains better my approximate approach to addressing the problem that the plots by experiment in vp reports are essentially redundant.
Instead of rewriting the various actions (another possibility which shouldn't be discounted/forgotten) I aimed to keep the idea of experiment as some arbitrary combination of datasets. There is a production rule which for a given fit, looks at the plotting info and then groups those datasets into experiments. Then one can do something like
and the plot will have bars according to the plotting experiments. I then added a provider
fixup_fitthcovmatwhich handles the loading of thefitthcovmatand fixes the experiment headers to match those of the experiments. Then anything which usedfitthcovmatnow usesfixup_fitthcovmatand inDataResultI now take the cross section offixup_fitthcovmatfor either experiment or dataset.The final step would be introducing some minimal #356 so that one can calculate total chi2s required for some tables and the
summarise_fitsaction. All of this is currently a bit gross at the moment, can probably be done in a cleaner way, or in fact I could stop with this approach and try something completely different, it has however produced this: (results include th covmat and may or may not be correct - they look rather sensible compared to not using th covmat but that's not very rigorous)