Giter Club home page Giter Club logo

Comments (6)

fonnesbeck avatar fonnesbeck commented on June 3, 2024

Hi Thomas,

Can you post a simple example with which we can debug the problem?

Thanks,
cf

from pymc.

twiecki avatar twiecki commented on June 3, 2024

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.

twiecki avatar twiecki commented on June 3, 2024

Also, as you can see, Uniform returns a very big negative number outside the support instead of -infinity.

from pymc.

twiecki avatar twiecki commented on June 3, 2024

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.

fonnesbeck avatar fonnesbeck commented on June 3, 2024

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.

fonnesbeck avatar fonnesbeck commented on June 3, 2024

Fixed in 8423d05

from pymc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.