{"action":"created","issue":{"url":"https://api.github.com/repos/pymc-devs/pymc3/issues/1209","repository_url":"https://api.github.com/repos/pymc-devs/pymc3","labels_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/1209/labels{/name}","comments_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/1209/comments","events_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/1209/events","html_url":"https://github.com/pymc-devs/pymc3/issues/1209","id":162515076,"number":1209,"title":"TypeError with scipy.stats.norm.cdf","user":{"login":"ralfer","id":1465806,"avatar_url":"https://avatars.githubusercontent.com/u/1465806?v=3","gravatar_id":"","url":"https://api.github.com/users/ralfer","html_url":"https://github.com/ralfer","followers_url":"https://api.github.com/users/ralfer/followers","following_url":"https://api.github.com/users/ralfer/following{/other_user}","gists_url":"https://api.github.com/users/ralfer/gists{/gist_id}","starred_url":"https://api.github.com/users/ralfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralfer/subscriptions","organizations_url":"https://api.github.com/users/ralfer/orgs","repos_url":"https://api.github.com/users/ralfer/repos","events_url":"https://api.github.com/users/ralfer/events{/privacy}","received_events_url":"https://api.github.com/users/ralfer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-06-27T18:19:39Z","updated_at":"2016-09-05T18:24:39Z","closed_at":null,"body":"I'm trying to convert this simple JAGS model to pymc3 and I'm getting type error with scipy.stats.norm.cdf. \r\n\r\nJAGS model (from https://github.com/drbenvincent/bayesian2afc/blob/master/jagsmodels/model1JAGS.txt):\r\n```\r\nmodel{\r\n\tv ~ dunif(0,1000)\r\n\tfor (c in 1:length(si)) {\t\r\n\t\tpc[c] <- phi( (si[c])/( sqrt(2*v) ) )\r\n\t\tk[c] ~ dbin(pc[c],T)\r\n\t\tpredk[c] ~ dbin(pc[c],T)\r\n\t}\r\n}\r\n```\r\n\r\nMy attempt at pymc3:\r\n```\r\nfrom pymc3 import *\r\nfrom scipy.stats import norm # for cumulative normal distribution\r\n\r\nsi = [0.01, 0.02, 0.05, 0.1, 0.22, 0.46, 1.0, 2.15, 4.64, 10.0]\r\nk = [50.0, 51.0, 57.0, 55.0, 63.0, 62.0, 82.0, 94.0, 99.0, 100.0]\r\n\r\nwith Model() as model: # model specifications in PyMC3 are wrapped in a with-statement\r\n    sigma = Uniform('sigma', lower=0, upper=1000, testval = 50)\r\n    pc = norm.cdf(si/sqrt(sigma*sigma))\r\n    predk = Binomial('predk',T, pc, observed = k)\r\n\r\n    start = find_MAP() \r\n    step = NUTS(scaling=start) \r\n    trace = sample(20000, step, start=start, progressbar=True) \r\n```\r\n\r\nI'm getting the following error:\r\n```\r\n   \"Variables do not support boolean operations. This \"\r\nTypeError: Variables do not support boolean operations. This can happen if you do a logical operation (<, <=, >, <=, ==, !=) between a numpy.ndarray and a Theano tensorvariable. Due to NumPy implementation before NumPy 1.8, we cannot make the Python syntax work when the ndarray is on the left, and this results in this error. To work around that, either call theano.tensor.{lt,le,eq,ne,gt,ge}(ndarray, tensor), or use the Python syntax with the Theano tensor on the left. Or update to NumPy 1.8 or above.\r\n```\r\n\r\nI assume that the problem is in using norm.cdf but I don't know how to fix it. Any help is appreciated. \r\n\r\nPS. I've also tried using Theano functions from basic_scipy but this code \r\n```\r\nfrom theano.scalar.basic_scipy import erfc\r\nfrom theano.scalar import sqrt\r\nfrom theano import shared\r\nsi = shared([0.01, 0.02, 0.05, 0.1, 0.22, 0.46, 1.0, 2.15, 4.64, 10.0])\r\n...\r\n    pc = -erfc(sqrt(2.0)*(si/sqrt(sigma**2))/2.0)/2.0 + 1.0 \r\n```\r\ngives an error: `TypeError: unsupported operand type(s) for /: 'SharedVariable' and 'ScalarVariable'`"},"comment":{"url":"https://api.github.com/repos/pymc-devs/pymc3/issues/comments/244795913","html_url":"https://github.com/pymc-devs/pymc3/issues/1209#issuecomment-244795913","issue_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/1209","id":244795913,"user":{"login":"fonnesbeck","id":81476,"avatar_url":"https://avatars.githubusercontent.com/u/81476?v=3","gravatar_id":"","url":"https://api.github.com/users/fonnesbeck","html_url":"https://github.com/fonnesbeck","followers_url":"https://api.github.com/users/fonnesbeck/followers","following_url":"https://api.github.com/users/fonnesbeck/following{/other_user}","gists_url":"https://api.github.com/users/fonnesbeck/gists{/gist_id}","starred_url":"https://api.github.com/users/fonnesbeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fonnesbeck/subscriptions","organizations_url":"https://api.github.com/users/fonnesbeck/orgs","repos_url":"https://api.github.com/users/fonnesbeck/repos","events_url":"https://api.github.com/users/fonnesbeck/events{/privacy}","received_events_url":"https://api.github.com/users/fonnesbeck/received_events","type":"User","site_admin":false},"created_at":"2016-09-05T18:24:39Z","updated_at":"2016-09-05T18:24:39Z","body":"They have `grad` methods that look like gradients."}}
{"actor":{"display_login":"fonnesbeck"}}