Pylint says non-scalar PyMC3 distributions are not subscriptable

I have a distribution defined as follows:

dprob_vector = pm.Deterministic('devp', deviations_by_input[input_id])

Elpy (emacs interface to python) runs pylint automatically on my code and flags the expression above as incorrect because it thinks deviations_by_input is not subscriptable. Here’s how deviations_by_input is defined:

deviations_by_input = pm.Beta("p(deviation)", alpha=1.0, beta=15.0, shape=num_inputs)

TBQH, I’m not sure how to make it obvious statically that a distribution (or any tensor?) is or is not subscriptable, since I don’t think there’s anything in the type system that distinguishes between scalars, vectors, and arrays.

Maybe the best I can do is to muffle this warning.

To be honest, I don’t know how to make pylint aware of the fact that pymc3 non scalar RVs are subscriptable. Maybe someone else here knows but for now I would recommend suppressing the warning.

I did a little further research about this pylint warning, and it seems like it is generally pretty garbagy; I don’t think there’s anything really useful about it, so there’s nothing worth doing about it wrt PyMC3.

1 Like