Thanks so much for your response! I have only one problem with it - when I try and run this
> pi = [0.3,0.4,0.2,0.1]
> X = pymc.Categorical('X', p=pi)
>
> mu = np.array([1,2,3,4])
> tau = np.array([1,2,1,2])
>
> mu_i = pymc.Lambda('mu_i', lambda X: mu[X])
I get an error: ValueError: mu_i: All arguments to lam_fun must have default values.
Running inspect.argspec on the lambda function confirms the lack of 'defaults':
inspect.getargspec(lam_fun)
Out[32]: ArgSpec(args=['X'], varargs=None, keywords=None, defaults=None)
After a bit of mucking about I can make it work using
mu_i = pymc.Lambda('mu_i', lambda X=0: mu[X])
(must admit to being embarrassed how long it took me to realise you can specify default values in lambda functions, despite it being rather clear in your documentation).
However, I'm concerned that I /have/ to specify default values - when are they used? How should I chose these?
M
> --
> You received this message because you are subscribed to the Google Groups "PyMC" group.
> To post to this group, send email to py...@googlegroups.com.
> To unsubscribe from this group, send email to pymc+uns...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pymc?hl=en.
>
cfmu_i = pymc.Lambda('mu_i', lambda X=X: mu[X])