{"action":"created","issue":{"url":"https://api.github.com/repos/pymc-devs/pymc3/issues/3248","repository_url":"https://api.github.com/repos/pymc-devs/pymc3","labels_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/3248/labels{/name}","comments_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/3248/comments","events_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/3248/events","html_url":"https://github.com/pymc-devs/pymc3/issues/3248","id":379336092,"node_id":"MDU6SXNzdWUzNzkzMzYwOTI=","number":3248,"title":"Error for default params of NoneType in pm.distributions.distribution._draw_value()","user":{"login":"gilliss","id":7737986,"node_id":"MDQ6VXNlcjc3Mzc5ODY=","avatar_url":"https://avatars3.githubusercontent.com/u/7737986?v=4","gravatar_id":"","url":"https://api.github.com/users/gilliss","html_url":"https://github.com/gilliss","followers_url":"https://api.github.com/users/gilliss/followers","following_url":"https://api.github.com/users/gilliss/following{/other_user}","gists_url":"https://api.github.com/users/gilliss/gists{/gist_id}","starred_url":"https://api.github.com/users/gilliss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gilliss/subscriptions","organizations_url":"https://api.github.com/users/gilliss/orgs","repos_url":"https://api.github.com/users/gilliss/repos","events_url":"https://api.github.com/users/gilliss/events{/privacy}","received_events_url":"https://api.github.com/users/gilliss/received_events","type":"User","site_admin":false},"labels":[{"id":538302060,"node_id":"MDU6TGFiZWw1MzgzMDIwNjA=","url":"https://api.github.com/repos/pymc-devs/pymc3/labels/beginner_friendly","name":"beginner_friendly","color":"bfd4f2","default":false},{"id":76646,"node_id":"MDU6TGFiZWw3NjY0Ng==","url":"https://api.github.com/repos/pymc-devs/pymc3/labels/defects","name":"defects","color":"e10c02","default":false},{"id":729810124,"node_id":"MDU6TGFiZWw3Mjk4MTAxMjQ=","url":"https://api.github.com/repos/pymc-devs/pymc3/labels/good_first_issue","name":"good_first_issue","color":"0052cc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-09T21:57:41Z","updated_at":"2019-01-02T06:36:17Z","closed_at":null,"author_association":"NONE","body":"I'm raising this issue following discussion at\r\nhttps://discourse.pymc.io/t/error-for-default-params-of-nonetype-in-pm-distributions-distribution-draw-value/2183\r\n\r\nI came across the following error when using `pm.distributions.continuous.TruncatedNormal.dist().random()`.\r\n```\r\nValueError: Unexpected type in draw_value: <class 'NoneType'>\r\n```\r\nThe error seems to be caused by the default values of `None` for the `upper` and `lower` parameters of the `BoundedContinuous` distribution object. That is,\r\n```\r\n>>> dist = pm.TruncatedNormal.dist()\r\n>>> type(dist.mu), dist.mu\r\n(<class 'theano.tensor.var.TensorConstant'>, TensorConstant{0})\r\n>>> type(dist.sd), dist.sd\r\n(<class 'theano.tensor.var.TensorConstant'>, TensorConstant{1.0})\r\n>>> type(dist.upper), dist.upper\r\n(<class 'NoneType'>, None)\r\n>>> type(dist.lower), dist.lower\r\n(<class 'NoneType'>, None)\r\n>>> dist.random()\r\nValueError: ...\r\n```\r\nIf I give a value to just one of 'upper' or 'lower', the error persists. If I give values to _both_ `upper` and `lower`, the error is avoided.\r\n```\r\n>>> dist.lower, dist.upper = 0, np.inf\r\n>>> dist.random()\r\narray(1.15514827)\r\n```\r\nAm I using the `random()` method in an unintended way? Perhaps it's just required that the user supply upper and lower bounds to the respective kwargs in `TruncatedNormal`-- in that case, it may be desirable to make those into positional arguments (matching `scipy.stats.truncnorm`).\r\n\r\n**Please provide a minimal, self-contained, and reproducible example.**\r\n```python\r\nimport pymc3 as pm\r\npm.TruncatedNormal.dist(lower = 0., upper = 100.).random() # no error\r\ntry: pm.TruncatedNormal.dist(lower = 0.).random() # error\r\nexcept ValueError: print('ValueError')\r\ntry: pm.TruncatedNormal.dist(upper = 100.).random() # error\r\nexcept ValueError: print('ValueError')\r\ntry: pm.TruncatedNormal.dist().random() # error\r\nexcept ValueError: print('ValueError')\r\n```\r\n\r\n**Please provide the full traceback.**\r\n```python\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/Applications/anaconda3/envs/Fit2/lib/python3.6/site-packages/pymc3/distributions/continuous.py\", line 578, in random\r\n    [self.mu, self.sd, self.lower, self.upper], point=point, size=size)\r\n  File \"/Applications/anaconda3/envs/Fit2/lib/python3.6/site-packages/pymc3/distributions/distribution.py\", line 321, in draw_values\r\n    evaluated[param_idx] = _draw_value(param, point=point, givens=givens.values(), size=size)\r\n  File \"/Applications/anaconda3/envs/Fit2/lib/python3.6/site-packages/pymc3/distributions/distribution.py\", line 418, in _draw_value\r\n    raise ValueError('Unexpected type in draw_value: %s' % type(param))\r\nValueError: Unexpected type in draw_value: <class 'NoneType'>\r\n```\r\n\r\n**Please provide any additional information below.**\r\n\r\n\r\n## Versions and main components\r\n\r\n* PyMC3 Version: 3.5\r\n* Theano Version: 1.0.2\r\n* Python Version: 3.6.6\r\n* Operating system: macOS 10.13.2\r\n* How did you install PyMC3: conda\r\n"},"comment":{"url":"https://api.github.com/repos/pymc-devs/pymc3/issues/comments/450794561","html_url":"https://github.com/pymc-devs/pymc3/issues/3248#issuecomment-450794561","issue_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/3248","id":450794561,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDc5NDU2MQ==","user":{"login":"KrUciFieR-Jr","id":21988185,"node_id":"MDQ6VXNlcjIxOTg4MTg1","avatar_url":"https://avatars1.githubusercontent.com/u/21988185?v=4","gravatar_id":"","url":"https://api.github.com/users/KrUciFieR-Jr","html_url":"https://github.com/KrUciFieR-Jr","followers_url":"https://api.github.com/users/KrUciFieR-Jr/followers","following_url":"https://api.github.com/users/KrUciFieR-Jr/following{/other_user}","gists_url":"https://api.github.com/users/KrUciFieR-Jr/gists{/gist_id}","starred_url":"https://api.github.com/users/KrUciFieR-Jr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrUciFieR-Jr/subscriptions","organizations_url":"https://api.github.com/users/KrUciFieR-Jr/orgs","repos_url":"https://api.github.com/users/KrUciFieR-Jr/repos","events_url":"https://api.github.com/users/KrUciFieR-Jr/events{/privacy}","received_events_url":"https://api.github.com/users/KrUciFieR-Jr/received_events","type":"User","site_admin":false},"created_at":"2019-01-02T06:36:17Z","updated_at":"2019-01-02T06:36:17Z","author_association":"NONE","body":"I would like to work on this issue"}}
{"actor":{"display_login":"KrUciFieR-Jr"}}