Open ckchmod opened 3 years ago
That interface is as intended: the function modifies the table, so it's not necessary to return it.
And for some purposes it is useful to see the total probability of the data.
On Thu, May 27, 2021, at 3:52 PM, CK wrote:
I believe the function update() should return the table, not "prob_data".
def update(table): """Compute the posterior probabilities.""" table['unnorm'] = table['prior'] * table['likelihood'] prob_data = table['unnorm'].sum() table['posterior'] = table['unnorm'] / prob_data return prob_data
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/AllenDowney/ThinkBayes2/issues/42, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOLP3PED4RGKY3BLVBKUL3TP2PGFANCNFSM45U7I3PQ.
I believe the function update() should return the table, not "prob_data".
def update(table): """Compute the posterior probabilities.""" table['unnorm'] = table['prior'] * table['likelihood'] prob_data = table['unnorm'].sum() table['posterior'] = table['unnorm'] / prob_data return prob_data