def CH7_1(): """ 球队2010-2011赛季, 平均每场进球的分布, 大致为均值2.8, 标准差为0.3的高斯分布 """ pmf = thinkbayes.MakeGaussianPmf(2.8, 0.3, 4, n=101) thinkplot.Clf() thinkplot.Pmf(pmf) thinkplot.Show();
def __init__(self, exam, score): self.exam = exam self.score = score # start with the Gaussian prior efficacies = thinkbayes.MakeGaussianPmf(0, 1.5, 3) thinkbayes.Suite.__init__(self, efficacies) # update based on an exam score self.Update(score)
def __init__(self, name=''): """Initializes the Hockey object. name: string """ if USE_SUMMARY_DATA: # prior based on each team's average goals scored mu = 2.8 sigma = 0.3 else: # prior based on each pair-wise match-up mu = 2.8 sigma = 0.85 pmf = thinkbayes.MakeGaussianPmf(mu, sigma, 4) thinkbayes.Suite.__init__(self, pmf, name=name)
def CalibrateDifficulty(self): """Make a plot showing the model distribution of raw scores.""" thinkplot.Clf() thinkplot.PrePlot(num=2) cdf = thinkbayes.MakeCdfFromPmf(self.raw, name='data') thinkplot.Cdf(cdf) efficacies = thinkbayes.MakeGaussianPmf(0, 1.5, 3) pmf = self.MakeRawScoreDist(efficacies) cdf = thinkbayes.MakeCdfFromPmf(pmf, name='model') thinkplot.Cdf(cdf) thinkplot.Save(root='sat_calibrate', xlabel='raw score', ylabel='CDF', formats=['pdf', 'eps'])
def __init__(self, mu, sigma, name=''): """ """ pmf = thinkbayes.MakeGaussianPmf(mu, sigma, 1) thinkbayes.Suite.__init__(self, pmf, name=name)