Comments (13)
I guess this is much easier to have this new output message than tracking down whether it was a parameter or a prior condition that caused the -inf likelihood.
from xpsi.
@thjsal , Maybe a message like this: Warning: Prior check failed. Either one parameter is not within bounds or a requirement set in CustomPrior has failed. will be more clear
from xpsi.
@thjsal The error message that we put to fix the issue is a bit misleading. In fact, if a parameter vector p fails the compactness test for example, then prior(p) will still return -inf. The error message will still print :'At least one of the parameters value is not within defined bound No synthesic data will be produced', even though all the parameters are within the strict bounds.
from xpsi.
I guess it depends what you define to be meaning of word "bounds". I would think returning minus infinity from prior(p) means that the parameter vector is outside of the prior bounds.
from xpsi.
I think @yveskini 's point is that the error message is misleading because the compactness is not part of the parameter list per se. So I could see this as being confusing for the users who has parameters (M and R) within the bounds but still this this error message.
from xpsi.
I see. Should we then change
print('At least one of the parameter values is not within the defined bounds.\n \
No synthetic data will be produced.')
to
print('At least one of the parameter values is not within the defined bounds or the multi-dimensional prior conditions (regarding e.g. compactness of the star) are not fulfilled.\n \
No synthetic data will be produced.')
or something like that?
from xpsi.
Well, tracking might be needed even after the new error message, but at least you will be then be more aware that it can be either of these (parameter hard bounds or a prior condition) that causes the problem. I can update this message.
from xpsi.
Let's update the message for now, and keep the issue open
from xpsi.
I updated the warning in pull request #188 . In order to close this issue, were you @sguillot hoping for a message that would directly tell whether or not it is caused by the hard bounds or by the CustomPrior conditions? I think currently doing that would require saving some extra information (or extra returned output) in the call function of Prior.py, to be able to separate these from what comes from the CustomPrior..... Although, the user who writes the CustomPrior might then still write the CustomPrior in a way which ruins this. So I am not sure if those changes would be worth doing.
I'm thinking that the new error message from Yves could be already fine.
from xpsi.
It might be actually impossible to separate these since in CustomPrior.py one can always overwrite the call function of Prior.py in whatever way that is wanted.
from xpsi.
Yes, I was arguing that a message that could differentiate Out of hard bounds VS CustomPrior conditions would be preferable for the user. But I understand if that's not easy (or impossible).
The only solution that I can think of is to compare each parameter with its bounds in the case that if not _np.isfinite(logprior)
. But:
- It will slow down the likelihood calls
- I'm not sure the bounds are accessible by a likelihood object. (are the bounds available in ParameterSubspace ?)
Please close the issue if there is no easy solution.
from xpsi.
Actually, slowing likelihood calls is not a problem, since we talk about synthesise function that is only used for generating synthetic data and not at all during sampling, as far as I understand. ...
Anyway, I realized your suggestion is possible to do and thus updated the pull request. I tested that it works using the Synthetic_data.ipynb
notebook in the examples_fast
directory. Please let me know, if that looks ok to you.
However, I noticed that in order for any prior checks to take even place here, I had to supply the prior object when creating the likelihood object there. If you forget to provide the prior object (like currently in our example notebook), you can still create synthetic data that is outside of your prior limits (since presumably you then have no other than the default priors, which will complain anyway if being outside of those). Was the idea to have the prior check (not using only the default strict bounds) done also in this example @yveskini ?
from xpsi.
The problem was fixed in this commit: 4f09d2e.
The synthetic data example script was there also updated to take the CustomPrior into account.
from xpsi.
Related Issues (20)
- Numerical issue in background marginalization
- Background upper limit not forced to be always non-zero
- All true values set to None if one them is None.
- Better error handling for background marginalisation
- Update publication list HOT 5
- Change default extension for image plane HOT 1
- Option to allow spherical star and other simplifications
- Docstring describing phases in synthesise.pyx can be clearer
- Let the fast example main.py vector actually match the data vector, and make the run faster with lower num energies
- Do not always round down when saving synthetic data as integers HOT 3
- Problem in the example run with small background at some channels
- `image_order_limit` helper docstring mentions no hard bounds if no argument is passed but default argument set to 3
- `args.hot_atmosphere_model` implementation generated for `main` by `module_generator` does not work when choosing blackbody atmosphere
- Signal plots produce wrong figures if including channel 0 and using logarithmic y-scale
- Cornerplotter has args that allow calculation of only 68, 90 and 95% credible intervals, but not 99% HOT 1
- Intervals calculated appear to be incorrect HOT 2
- Likelihood does not support Everywhere
- Possible bug in module generator
- Update X-PSI installation instructions for Helios
- Deprecate/remove `TwoHotRegions`?
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 xpsi.