Comments (6)
Hi Thomas,
Can you post a simple example with which we can debug the problem?
Thanks,
cf
from pymc.
Example code :
https://gist.github.com/1045292
Output:
python example_breaks_map.py
t: value set to 0.603171404722
t: logp accessed.
t: Returning log-probability 0.0
t: value set to 0.603171404722
t: logp accessed.
t: Returning log-probability 0.0
t: value set to 0.633329974958
t: logp accessed.
t: Returning log-probability 0.0
t: value set to 0.573012834486
t: logp accessed.
t: Returning log-probability 0.0
t: value set to 0.542854264249
t: logp accessed.
t: Returning log-probability 0.0
t: logp accessed.
t: Returning log-probability 0.0
Current log-probability : -16.280555
t: value set to 0.482537123777
t: logp accessed.
t: Returning log-probability 0.0
t: value set to 0.422219983305
t: logp accessed.
t: Returning log-probability 0.0
t: logp accessed.
t: Returning log-probability 0.0
Current log-probability : -15.619173
t: value set to 0.301585702361
t: logp accessed.
t: Returning log-probability 0.0
t: value set to 0.180951421416
t: logp accessed.
t: Returning log-probability 0.0
t: logp accessed.
t: Returning log-probability 0.0
Current log-probability : -14.340067
t: value set to -0.0603171404722
t: logp accessed.
t: Returning log-probability -1.79769313486e+308
t: value set to 0.301585702361
t: logp accessed.
t: Returning log-probability 0.0
t: logp accessed.
t: Returning log-probability 0.0
Current log-probability : -14.972344
t: value set to 0.0603171404722
t: logp accessed.
t: Returning log-probability 0.0
t: value set to -0.0603171404722
t: logp accessed.
t: Returning log-probability -1.79769313486e+308
t: logp accessed.
t: Returning log-probability -1.79769313486e+308
Traceback (most recent call last):
File "example_breaks_map.py", line 7, in
pm.MAP([t,y]).fit(verbose=1)
File "pymc/NormalApproximation.py", line 273, in fit
disp=verbose)
File "scipy/optimize/optimize.py", line 259, in fmin
callback(sim[0])
File "pymc/NormalApproximation.py", line 250, in callback
print 'Current log-probability : %f' %self.logp
File "pymc/Node.py", line 340, in _get_logp
return logp_of_set(self.stochastics | self.potentials | self.observed_stochastics)
File "pymc/Node.py", line 19, in logp_of_set
logp += obj.logp
File "pymc/PyMCObjects.py", line 832, in get_logp
raise ZeroProbability, self.errmsg + "\nValue: %s\nParents' values:%s" % (self._value, self._parents.value)
pymc.Node.ZeroProbability: Stochastic t's value is outside its support,
or it forbids its parents' current values.
Value: -0.0603171404722
Parents' values:{'upper': 1, 'lower': 0}
from pymc.
Also, as you can see, Uniform returns a very big negative number outside the support instead of -infinity.
from pymc.
Just noticed that the problem only exists when setting verbose=1 in MAP.fit(). If this it not done, the exception is not raised (or ignored?).
However, when running with verbose=0, it will happily find the parameter value t=-5 (i.e. outside the support). So it seems that MAP then ignores any distribution parameters of non-observed variables. Is this intended behavior?
from pymc.
That big negative number comes from FORTRAN, which is where all of our log-probabilities are calculated. It serves the same purpose as -inf.
I think the problem here is simply that logp is calculated simply for reporting, and because the value of t is outside the support, an exception is raised, which is the appropriate behavior for MCMC, but not here. I will fix this.
from pymc.
Fixed in 8423d05
from pymc.
Related Issues (20)
- Rename sample_prior_predictive argument from samples to draws
- `dataset_to_point_list` fails when chain, draw are not the leading dims HOT 1
- sample_posterior_predictive wrongly considers Deterministic variables as source of volatility
- MissingInputError: Input 0 of the graph HOT 2
- BUG: return_inferencedata=True causes sample_smc to randomly fail HOT 2
- BUG: Unable to apply `Interval` foward transformation HOT 3
- DOC: Clarify shape vs size HOT 4
- Extend support to Python 3.12 HOT 2
- Allow partial imputation with `pm.observe`
- BUG: `pm.sample_posterior_predictive` discards new results when `extend_inferencedata=True` and `posterior_predictive` group already exists HOT 2
- `pymc.testing` attempts to import `pytest` but `pytest` is not in `pymc` install requirements HOT 2
- BUG: Generation of random draws from Weibull returns constant values HOT 2
- Add a helper `pm.compute_deterministics` to compute any deterministics on demand
- DOC: typos in example code for pymc.CustomDist HOT 1
- BUG: `pymc.sample_smc` fails with `pymc.CustomDist` HOT 2
- BUG: pymc import fails with `scipy==1.13.0` HOT 5
- Release workflow is still running on Python 3.7
- BUG: HSGP making wrong out-of-sample predictions when X domain changes
- pymc.gp.util.stabilize is broken HOT 1
- The behavior of `.squeeze()` is different between `shape=(...)` and `dims=(...)`. HOT 6
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 pymc.