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)
- ENH: Overloading of the `TensorVariable` CLass add(+) operator(or new attributes) HOT 13
- DOC: format of the initial values for the sample_smc function HOT 1
- BUG: Forward sampling with dims fails when mode="JAX" HOT 7
- BUG: NaNs in logp mess up resampling step in SMC HOT 6
- BUG: Slicing after adstock transformation not working HOT 3
- Implement `Ordered` distribution factory HOT 6
- Add PyArrow backend
- Runtime error windows. Anaconda HOT 1
- BUG: NotConstantValueError when using coordinates observed data with missing values with pymc==5.14.0 HOT 3
- BUG: passing the 'max_n_steps' parameter as kwarg to HurdleNegativeBinomial distribution does not work HOT 2
- Refactor/Upgrade `find_MAP` HOT 1
- ENH: Update reported sampler diagnostics for `pm.Slice()` step method HOT 2
- BUG: Adding a Deterministic results in the error: `All variables needed to compute inner-graph must be provided as inputs under strict=True` HOT 8
- Test `freeze_rv_and_dims` with `PartiallyObservedRV` HOT 1
- ENH: Customizable plate labels HOT 11
- First time congratulatory message images are huge HOT 8
- DOC: Plots squished in the documentation page HOT 2
- Problematic casting of integers in `convert_observed_data`
- ENH: Get sampling working using Apple Silicon GPU via jax backend HOT 32
- DOC: conflicting `fixed_params` type-hint in `find_constrained_prior` HOT 1
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.