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, division89from thinkbayes import Suite101112class Dice(Suite):13"""Represents hypotheses about which die was rolled."""1415def Likelihood(self, data, hypo):16"""Computes the likelihood of the data under the hypothesis.1718hypo: integer number of sides on the die19data: integer die roll20"""21if hypo < data:22return 023else:24return 1.0/hypo252627def main():28suite = Dice([4, 6, 8, 12, 20])2930suite.Update(6)31print('After one 6')32suite.Print()3334for roll in [8, 7, 7, 5, 4]:35suite.Update(roll)3637print('After more rolls')38suite.Print()394041if __name__ == '__main__':42main()434445