Code Monkey home page Code Monkey logo

Comments (4)

fonnesbeck avatar fonnesbeck commented on August 26, 2024

This is because you filled the missing values with 999999, which is outside the support of the variable. You need to give it a valid value, but not one that occurs in the non-missing data.

Also, note that you don't have to pass plot=False for observed stochastics. They will not get printed.

from pymc2.

fbnrst avatar fbnrst commented on August 26, 2024

Thanks @fonnesbeck for pointing this out!

So does that means if my observed data contains all possible values inside the support I cannot treat missing data?
E.g. consider the following example:

observed_values = sp.random.binomial(n = 3.0, p = 0.5, size = 100)
print(sp.unique(observed_values))

Output:

[0 1 2 3]

What to choose for the masked value?

mask = sp.zeros_like(observed_values)
mask[0] = True
masked_values = sp.ma.masked_array(observed_values, mask = mask, masked_values = ????)

Is it really necessary that pymc checks for the masked value to be in the support? Because I have the following situation: I do have a model where the n of the binomials actually is a random variable itself. And I'm fitting a number of datasets. That means I would have to check which masked value to use for every dataset which is certainly possible, but sometimes I might not be able to find a masked value. So I would vote for not checking if the missing values are inside the support. Would you agree.

from pymc2.

fonnesbeck avatar fonnesbeck commented on August 26, 2024

You can give it a non-integer value in order to avoid the problem that you cite. For example, if you fill with, say, 1.5 that should work.

Its not a matter of PyMC "checking" the the values are inside the support, it is just that PyMC calculates the log-probability at the first iteration, and therefore the values inserted for the missing values at the first iteration have to be valid. If you give discrete values a floating point value, it should end up getting truncated when converted to integers, so that will work.

from pymc2.

fbnrst avatar fbnrst commented on August 26, 2024

Thanks @fonnesbeck, using 1.5 works in my example.

btw: Using the plot = False option for observed stochastics makes makes sense if there are missing data because it will be plotted otherwise.

from pymc2.

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.