Created
April 2, 2015 16:16
-
-
Save etheriqa/89233cbf7657e4f9870d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from pymc import Binomial, MCMC, Matplot, Uniform | |
n_iter = 10000 | |
n_problem = 30 | |
n_problem_pass = 18 | |
score = [26, 28, 25, 22, 25] | |
p = Uniform('p', 0., 1.) | |
x = Binomial('x', n=n_problem, p=p, value=score, observed=True) | |
y = Binomial('y', n=n_problem, p=p) | |
m = MCMC([p, x, y]) | |
m.sample(n_iter) | |
Matplot.plot(y) | |
print('pass rate: {0:f} %'.format(len(list(filter(lambda x: x >= n_problem_pass, m.trace('y')))) / 100.)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment