Coder Social home page Coder Social logo

fonnesbeck / bios8366 Goto Github PK

View Code? Open in Web Editor NEW
532.0 57.0 356.0 108.68 MB

Advanced Statistical Computing at Vanderbilt University Medical Center's Department of Biostatistics

Home Page: http://fonnesbeck.github.io/Bios8366/

HTML 0.34% Jupyter Notebook 98.87% Python 0.79%

bios8366's Issues

E-step for ZIP data

In the Expectation and Maximization notebook,

I am not sure, but can you check the following E-step

     a = psi * (x == 0)
     b = (1-psi)*poisson.pmf(x, mu)

is correct? The following can be correct.

    a = (1-psi) * (x == 0)
    b = psi*poisson.pmf(x, mu)

typo in e_step

Excellent work.
And I found a typo in Section3_1-Expectation-Maximization.ipynb-General formulation

from scipy.stats.distributions import norm

def e_step(x, mu, sigma, psi):
    a = psi * norm.pdf(x, mu[0], sigma[0])
    b = (1. - psi) * norm.pdf(x, mu[1], sigma[1])
    return b / (a + b)

should be

def e_step(x, mu, sigma, psi):
    a = (1. - psi) * norm.pdf(x, mu[0], sigma[0])
    b =  psi * norm.pdf(x, mu[1], sigma[1])
    return b / (a + b)

Becasue m_step output psi of second distribution and to be consistent with formula.

wrong implementation of function "conditional".

The conditional function takes as input (x_new, x, y, params), there is no need to pass y in the function. By definition of conditional probability above conditional distribution, "x_new" represent "x" and "x" represent "y".

Correct implementation would be:

def conditional(x_new, x, params):
B = exponential_cov(x_new, x, params)
C = exponential_cov(x, x, params)
A = exponential_cov(x_new, x_new, params)
mu = np.linalg.inv(C).dot(B.T).T.dot(x) // y is replace by x.
sigma = A - B.dot(np.linalg.inv(C).dot(B.T))
return(mu.squeeze(), sigma.squeeze())

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.