Repository for a workshop on Bayesian statistics
"""This file contains code for use with "Think Bayes",1by Allen B. Downey, available from greenteapress.com23Copyright 2012 Allen B. Downey4License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html5"""67from __future__ import print_function, division89import thinkbayes10import thinkplot111213class Train(thinkbayes.Suite):14"""Represents hypotheses about how many trains the company has.1516The likelihood function for the train problem is the same as17for the Dice problem.18"""19def Likelihood(self, data, hypo):20"""Computes the likelihood of the data under the hypothesis.2122hypo: number of trains the carrier operates23data: the number of the observed train24"""25# fill this in!26return 127282930def main():31hypos = range(100, 1001)32suite = Train(hypos)3334suite.Update(321)3536thinkplot.PrePlot(1)37thinkplot.Pmf(suite)38thinkplot.Show(xlabel='Number of trains',39ylabel='Probability',40legend=False)414243if __name__ == '__main__':44main()454647