These are chat archives for bayespy/bayespy
from bayespy import nodes import numpy as np n_colors = 5 #Number of colors in each bag n_bags = 3 # Number of bags p_theta = nodes.Dirichlet(np.ones(n_colors), plates=(n_bags,), name='p_theta') data = nodes.Multinomial(n_colors, p_theta, plates=(3, 10), name='data')
But it gives the error with the number of plates
The plates (3,) of the parents are not broadcastable to the given plates (3, 10).
@jluttine yes 10 is the number of trails . And the task is to predict the number the distribution of the different colors(5 colors) in each bag. Each trial we take 1 ball from each bag, thus by taking 10 balls need to predict the distribution in each bag.
Based on the data set, I have i think categorical is the distribution to use
#Generate some random distributions to fill in each timezone p_color = nodes.Dirichlet(1e-1 * np.ones(n_colors), plates = (n_bags,)).random() #Randomly choose the timezone in which the reading is being undertaken draw_marbles = nodes.Categorical(p_color, plates=(10,n_bags)).random()
This gives error
draw_marbles = nodes.Multinomial(n_colors, p_color, plates=(10,n_bags)).random()
data = nodes.Multinomial(n_colors, p_theta, plates=(10,3), name='data') data.observe([[1,1,1,1,6],[1,2,3,4,0], [1,2,3,4,0]])
gives an error
Counts must sum to the number of trials .
10 was put in plates to signify the trails and each row sums upto 10 .
pip install git+https://github.com/bayespy/bayespy.git@develop