Comments (3)
I think it would be useful to add this under contrib
. We'll need to figure out the spec for this that is close to HS3 as possible. Aside -- more of a technical question -- in the example notebook provided
hist1 = np.array([2. , 3., 6., 8., 7., 7., 6., 2., 3., 1.])
hist2 = np.array([3. , 6., 9., 12., 15., 9., 6., 3., 3., 2.])
How do I know what the resulting fully-correlated histogram should look like under "corr": [[1., 1.], [1., 1.]],
? Looking at the code you provided, it's not clear at all to me. It seems you use pca
to determine the appropriate shifting that needs to be done for each entry in the correlation matrix, but I don't see how you're actually shifting or computing the new histograms/modifiers: https://github.com/lorenzennio/pyhfcorr/blob/32a006651e9410e6107ae5077021feddb17b7b50/src/pyhfcorr/decorrelate.py#L126-L154
Also from a naive look through, my guess is we want to use TensorViewer
somehow or similar that we have in pyhf
into this, but that might complicate the logic. We'll also need to add a few tests for it.
from pyhf.
I need to have a more detailed look, am I understanding correctly that this effectively defines new uncorrelated parameters? When reading this issue I at first expected multi-dimensional Gaussian constraint terms to model covariances, but I think this goes the opposite direction and defines pyhf-compatible uncorrelated parameters from correlated input.
from pyhf.
@kratsg As you say, I am using PCA to transform the correlated variables to an equal number of uncorrelated ones. For each of the uncorrelated variables, I determine the corresponding shift and add this as a new modifier. For two fully correlated variables, only one new modifier is added with the sum of the up/down variations (in the histosys
case) as data (the second modifier would be redundant in this case). (as in the first example here https://github.com/lorenzennio/pyhfcorr/blob/main/examples.ipynb)
The shifts are calculated here:
https://github.com/lorenzennio/pyhfcorr/blob/main/src/pyhfcorr/modifiers.py
which are called from this line:
https://github.com/lorenzennio/pyhfcorr/blob/32a006651e9410e6107ae5077021feddb17b7b50/src/pyhfcorr/decorrelate.py#L138
Does that answer your question?
We'll need to figure out the spec for this that is close to HS3 as possible.
Good point, we should align it with how correlations are treated in HS3. The other, simple solution, would be to just take the decorrelated spec, which is completely pyhf
compatible and hence no changes would be needed. I guess, the prior approach would be more desirable though.
Also from a naive look through, my guess is we want to use TensorViewer somehow or similar that we have in pyhf into this, but that might complicate the logic.
Do you mean replacing the numpy
dependency that I introduced with the general tensor
backend used in pyhf
? I can have a go at this if you want.
We'll also need to add a few tests for it.
I have added some tests here:
https://github.com/lorenzennio/pyhfcorr/tree/main/test
Of course, these could be extended as needed.
@alexander-held Exactly, I am transforming and adding new uncorrelated parameters. The reason I opted for this, is that it is a simple pre-processing step, and it is non-invasive to the actual pyhf/HistFactory model. What would the benefit of multivariate constraint terms, apart from the interpretability of the resulting modifier parameters (which is partially lost in my approach)?
from pyhf.
Related Issues (20)
- Remove `InvalidNameReuse` exception in favor of in `InvalidModel`
- Typing for tensor shapes
- `ValueError: The truth value of an array` ... when using `fixed_params` kwarg for `pyhf.infer.hypotest` HOT 4
- Release v0.7.6 checklist
- Using the hessian matrix in optimization HOT 2
- Typo in docs for qmutilde test-statistic
- Implementation of fixed params in scipy minimizer
- Switch to using 'tensorflow' for Apple silicon Macs for TensorFlow v2.16.1+ HOT 2
- docs linkcheck failing for SciPy conference proceedings
- In Python 3.12 xml.etree.ElementTree will raise DeprecationWarning: Testing an element's truth value will raise an exception in future versions
- In Python 3.12 tarfile raises DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. HOT 1
- Forced measurement object schema validation through `ws.model()` HOT 1
- Inconsistent return types of `model.config.suggested_bounds()` when using parameter config
- toms748_scan doesn't work with JAX backend HOT 6
- xml2json breaks with HistoPath including filename HOT 2
- Move documentation pages to PyData Sphinx Theme HOT 1
- Use PyData Sphinx Theme docs version switcher
- Warn when parameter hits bounds HOT 3
- Improve error messages/hints when "Estimated distance to minimum too large." HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyhf.