pymc implementation of ThinkBayes 1.3 cookie problem This is obviously overkill for this problem, but I thought it would help cement the concepts for me.
The problem:

Suppose there are two bowls of cookies. Bowl 1 contains 30 vanilla cookies and 10 chocolate cookies. Bowl 2 contains 20 of each.
  Now suppose you choose one of the bowls at random and, without looking, select a cookie at random. The cookie is vanilla. What is the probability that it came from Bowl 1?

Here is my attempt:
import pymc as mc

which_bowl = mc.Categorical('which_bowl', [.5,.5])

bowl_probs = [ 
   # vanilla, chocolate
   [.75,      .25],       # bowl 1
   [.5,       .5 ],       # bowl 2
]

@mc.deterministic
def bowl(which_bowl=which_bowl):
   return bowl_probs[which_bowl]

observation = mc.Categorical('obs', bowl, value=0, observed=True)

model = mc.Model([which_bowl, bowl, observation])
mcmc = mc.MCMC(model)
mcmc.sample(15000, 3000)

bowl_data = mcmc.trace('bowl')[:]

print 1.0 * sum(bowl_data) / len(bowl_data)

Solving this by hand gives: 
.6 

But the code above results in
[ 0.64997917  0.35002083]

That .6499 doesn't seem close enough to the expected .6. I'd appreciate help identifying what's wrong with my setup.
 A: Here is my attempt at implementing OPs model in PyMC3:
import numpy as np
import pymc3 as pm
import theano

with pm.Model() as model:
    p = theano.shared( np.array([
        # vanilla, chocolate
        [.75, .25],  # bowl 1
        [.5, .5],    # bowl 2
    ]) )
    which_bowl = pm.Categorical('which_bowl', np.array([.5, .5]))
    bowl = pm.Deterministic('bowl', p[which_bowl])
    observation = pm.Categorical('obs', bowl, observed=0)
    step = pm.Metropolis()
    trace = pm.sample(150000, init=None, tune=10000)

bowl_trace = trace['which_bowl']

for i in range(2):
    print('Prob the cookie was picked from bowl #{}: {:.5f}'.format(i, (bowl_trace == i).mean()))

which yields
Prob the cookie was picked from bowl #0: 0.59896
Prob the cookie was picked from bowl #1: 0.40104

A: Thanks for sharing your efforts on this.
FWIW, I got it to work with some minor tweaks
import pymc as mc

bowl = mc.Categorical('which_bowl', [.5,.5])

p = [
   # vanilla, chocolate
   [.75,      .25],       # bowl 1
   [.5,       .5 ],       # bowl 2
]

@mc.deterministic
def bowl_selection(p=p, bowl=bowl):
   return p[bowl]

observation = mc.Categorical('obs', bowl_selection, value=0, observed=True)

mcmc = mc.MCMC([bowl, p, bowl_selection, observation])
mcmc.sample(15000, 3000)

bowl_trace = mcmc.trace('which_bowl')[:]

Now the posterior probabilities for the hypotheses are
(bowl_trace == 0).sum()*1./ bowl_trace.shape[0]

and
(bowl_trace == 1).sum()*1./ bowl_trace.shape[0]

