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

predictive explorer: report unknow boundaries #175

Open
aloctavodia opened this issue Jan 10, 2023 · 2 comments
Open

predictive explorer: report unknow boundaries #175

aloctavodia opened this issue Jan 10, 2023 · 2 comments

Comments

@aloctavodia
Copy link
Contributor

aloctavodia commented Jan 10, 2023

In #173 sliders (now textboxes) become aware of a few functions that can be applied to the parameters. Providing a truly general solution will probably be too hard, and it may require a different approach to parse the function. Something easier may be to detect 3 categories, no function has been applied, a function/operation is applied and we can solve it, and a function/operation is applied but we don't have a clue what is going on, for this later case we could return something like "(unk, unk)", signaling that the function is not able to guess the boundaries of the parameter.

@aloctavodia aloctavodia changed the title predictive sliders predictive sliders: report unknow boundaries Jan 17, 2023
@aloctavodia aloctavodia changed the title predictive sliders: report unknow boundaries predictive explorer: report unknow boundaries Oct 24, 2023
@rohanbabbar04
Copy link
Contributor

In predictive_explorer, for the later case a function/operation is applied but we don't have a clue what is going on.

Can you give me an instance/example of when we may encounter this situation?

@aloctavodia
Copy link
Contributor Author

See the example here

https://preliz.readthedocs.io/en/latest/examples/observed_space_examples.html#predictive-explorer

here the boundaries for a_sigma are correctly defined as (0, inf).

and if you change the line a = pz.Normal(a_mu, a_sigma).rvs() for a = pz.Normal(a_mu, a_sigma**2).rvs() or a = pz.Normal(a_mu, np.exp(a_sigma)).rvs()

the boundary will turn to be (-inf, inf), which is correct. But if you instead have something like a = pz.Normal(a_mu, func(a_sigma)).rvs() where func is an arbitrary Python function we do not know what to do (even if that python function is encapsulating np.exp!).

The easy solution is not to provide information for the boundaries and let the code fail, which is not that bad because if the user sets a wrong value, the plot will return an error and it will go back to normal if the user sets a good value again. So maybe it is enough if we catch that error and return a nicer message just saying, "Hey the value you provide is bad, try something different"...

Having said that it would be nice to provide some info for the boundaries, even if we can not always provide that info (this is the topic of this issue). A good solution is to get that information when parsing the function and detecting when we do not know.

An alternative is to use a brute-force approach (maybe only for the things we don't know) to automatically try different values at initialization and catch when we get errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants