Multinomial logistic regression - pymc3

I started trying out pymc3 and you need to implement a multivariate logistic regression model. I have studied twiecki tutorials and I understand his implementations of hierarchical regression models (see https://twiecki.github.io/blog/2014/03/17/bayesian-glms-3/ ) as well as some basic binary regression logistics examples in pymc3. I haven't seen any extensions of this for multivariate logistic regressions yet. Is there support for this with pymc3 GLM? Or how to implement this without using GLM? Here is a link to the iPython notebook where I am trying to solve the problem, although I know I am missing something meaningful here: http://nbviewer.ipython.org/github/mvictor212/pymc-multinom-logit/blob/master/ MultinomialLogisticRegression% 20-% 20Radon% 20Level.ipynb p>

+3


source to share


1 answer


Categorically parameterized by a vector of probabilities, one for each class, which add up to one (PyMC expects probability k-1 and calculates the latter by subtraction). In this example, it looks like you're only getting one probability for each observation if I read your code correctly. (Also, this is what your error suggests - it got index 1 when the parameter vector is of size 1).

For example, let's say I had data that represented three classes:

[0, 2, 2, 1, 0, 2, 1, 0, 1, 1]

      



Then I should have a vector of values ​​for p of length 2, for example:

p = [0.4, 0.3]

      

+1


source







All Articles