Closed sreedat closed 3 years ago
I also tested the exact same data set and model specifications with pymc3 V4
(using m2w64-toolchain with gcc 5.3.0
and I got a different type of error:
NotImplementedError: Cannot convert <built-in function id> to a tensor variable.
(What is the id being referred to here?) There is a column in the data set labeled id for the Region ID. See the above post for more detailed description. If this is deemed a genuine problem then I will post it as a separate issue for pymc3 V4 / aeasara
The line Cannot convert <built-in function id> to a tensor variable.
refers to your code: You're trying to use id
as a variable name, but id
is a built-in function.
Typically overriding it should work, so I suspect you have a mixup somwhere upstream to the code example you posted.
The best practice would be to either use a different variable name alltogether, or use a suffix such as id_
to avoid conflicting with the built-in function.
@michaelosthege sorry for the delay in following up. I had a case of break through covid that left me down and out. Changing the id
to a different name ensured it ran correctly. Thanks again.
Data and Model Description: Setting up a basic Hierarchical model of Weekly Sales as a function of weekly RepVisits and Samples among 10 regions. The data set has 52 weeks of data for each region. Five columns of data: id : Region ID from 1 to 10 weeks : Week numbers from 1 to 52 sales : Weekly regional sales repvisits : Number of weekly field rep visits to certain stores samples : Number of trial samples taken during Demos by customers
Note: Sales, RepVisits, and Samples are captured as Real / Float in the dataset and not as Integers
Version Information:
pymc3
: 3.11.3OS
: Windows 10 64-bitPython
: 3.9.6 via Anaconda3-2021.05-Windows-x86_64theano-pymc
: 1.1.2pymc3 install via
:pip install pymc3
gcc 8.3.0
: via RTools mingw compiler tool set / did not usem2w64-toolchain
astheano-pymc
failsReproducible code - I do not know how to attach my data (in a CSV format) if you let me know I can share it. Rest of the code and the error and complete traceback are below:
Reading in the Sales data for 10 regions Data for 52 weeks (region ID, week number, sales, repvisits, and samples)
Confirming that the count of Regions is 10
Defining the model (adapted from the Radon measurement example here with minimal changes: https://docs.pymc.io/notebooks/GLM-hierarchical.html)
Results in the following error:
TypeError: Unsupported dtype for TensorType: object
Full Traceback of the error:
KeyError Traceback (most recent call last) C:\ProgramData\Anaconda3\envs\pm3py39\lib\site-packages\theano\tensor\type.py in dtype_specs(self) 264 try: --> 265 return { 266 "float16": (float, "npy_float16", "NPY_FLOAT16"), KeyError: 'object' During handling of the above exception, another exception occurred: TypeError Traceback (most recent call last) C:\Users\SREEDATTA\AppData\Local\Temp/ipykernel_12844/3227314761.py inOutput from Conda List in the Environment
# Name Version Build Channel argon2-cffi 20.1.0 py39hb82d6ee_2 conda-forge arviz 0.11.2 pypi_0 pypi async_generator 1.10 py_0 conda-forge attrs 21.2.0 pyhd8ed1ab_0 conda-forge backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 py_2 conda-forge backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge bambi 0.6.0 pypi_0 pypi blas 1.0 mkl conda-forge bleach 4.0.0 pyhd8ed1ab_0 conda-forge ca-certificates 2021.7.5 haa95532_1 cachetools 4.2.2 pypi_0 pypi cairo 1.16.0 hb19e0ff_1008 conda-forge cffi 1.14.6 py39h0878f49_0 conda-forge cftime 1.5.0 pypi_0 pypi colorama 0.4.4 pyh9f0ad1d_0 conda-forge cycler 0.10.0 pypi_0 pypi debugpy 1.4.1 py39h415ef7b_0 conda-forge decorator 5.0.9 pyhd8ed1ab_0 conda-forge defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge dill 0.3.4 pypi_0 pypi entrypoints 0.3 pyhd8ed1ab_1003 conda-forge expat 2.4.1 h39d44d4_0 conda-forge fastprogress 1.0.0 pypi_0 pypi filelock 3.0.12 pypi_0 pypi font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge font-ttf-inconsolata 3.000 h77eed37_0 conda-forge font-ttf-source-code-pro 2.038 h77eed37_0 conda-forge font-ttf-ubuntu 0.83 hab24e00_0 conda-forge fontconfig 2.13.1 h1989441_1005 conda-forge fonts-conda-ecosystem 1 0 conda-forge fonts-conda-forge 1 0 conda-forge formulae 0.1.4 pypi_0 pypi freetype 2.10.4 h546665d_1 conda-forge fribidi 1.0.10 h8d14728_0 conda-forge getopt-win32 0.1 h8ffe710_0 conda-forge gettext 0.19.8.1 h1a89ca6_1005 conda-forge graphite2 1.3.13 1000 conda-forge graphviz 2.48.0 hefbd956_0 conda-forge gts 0.7.6 h7c369d9_2 conda-forge harfbuzz 2.9.0 hc601d6f_0 conda-forge icu 68.1 h0e60522_0 conda-forge importlib-metadata 4.6.4 py39hcbf5309_0 conda-forge intel-openmp 2021.3.0 h57928b3_3372 conda-forge ipykernel 6.2.0 py39h832f523_0 conda-forge ipython 7.26.0 py39h832f523_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge jbig 2.1 h8d14728_2003 conda-forge jedi 0.18.0 py39hcbf5309_2 conda-forge jinja2 3.0.1 pyhd8ed1ab_0 conda-forge jpeg 9d h8ffe710_0 conda-forge jsonschema 3.2.0 pyhd8ed1ab_3 conda-forge jupyter_client 6.1.12 pyhd8ed1ab_0 conda-forge jupyter_core 4.7.1 py39hcbf5309_0 conda-forge jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge kiwisolver 1.3.1 pypi_0 pypi lerc 2.2.1 h0e60522_0 conda-forge libblas 3.9.0 1_h8933c1f_netlib conda-forge libcblas 3.9.0 5_hd5c7e75_netlib conda-forge libdeflate 1.7 h8ffe710_5 conda-forge libffi 3.3 h0e60522_2 conda-forge libgd 2.3.2 h138e682_0 conda-forge libglib 2.68.4 h1e62bf3_0 conda-forge libiconv 1.16 he774522_0 conda-forge liblapack 3.9.0 5_hd5c7e75_netlib conda-forge libpng 1.6.37 h1d00b33_2 conda-forge libpython 2.0 py39hcbf5309_1 conda-forge libsodium 1.0.18 h8d14728_1 conda-forge libtiff 4.3.0 h0c97f57_1 conda-forge libwebp 1.2.1 h57928b3_0 conda-forge libwebp-base 1.2.1 h8ffe710_0 conda-forge libxcb 1.13 hcd874cb_1003 conda-forge libxml2 2.9.12 hf5bbc77_0 conda-forge llvmlite 0.36.0 py39ha0cd8c8_0 conda-forge lz4-c 1.9.3 h8ffe710_1 conda-forge m2w64-gcc-libgfortran 5.3.0 6 conda-forge m2w64-gcc-libs 5.3.0 7 conda-forge m2w64-gcc-libs-core 5.3.0 7 conda-forge m2w64-gmp 6.1.0 2 conda-forge m2w64-libwinpthread-git 5.0.0.4634.697f757 2 conda-forge m2w64-openblas 0.2.19 1 msys2 markupsafe 2.0.1 py39hb82d6ee_0 conda-forge matplotlib 3.4.3 pypi_0 pypi matplotlib-inline 0.1.2 pyhd8ed1ab_2 conda-forge mistune 0.8.4 py39hb82d6ee_1004 conda-forge mkl 2021.3.0 haa95532_524 mkl-service 2.4.0 py39hb82d6ee_0 conda-forge msys2-conda-epoch 20160418 1 conda-forge nbclient 0.5.4 pyhd8ed1ab_0 conda-forge nbconvert 6.1.0 py39hcbf5309_0 conda-forge nbformat 5.1.3 pyhd8ed1ab_0 conda-forge nest-asyncio 1.5.1 pyhd8ed1ab_0 conda-forge netcdf4 1.5.7 pypi_0 pypi notebook 6.4.3 pyha770c72_0 conda-forge numba 0.53.1 py39hb8cd55e_1 conda-forge numpy 1.21.2 py39h6635163_0 conda-forge openssl 1.1.1k h8ffe710_1 conda-forge packaging 21.0 pyhd8ed1ab_0 conda-forge pandas 1.3.2 pypi_0 pypi pandoc 2.14.1 h8ffe710_0 conda-forge pandocfilters 1.4.2 py_1 conda-forge pango 1.48.9 hd84fcdd_0 conda-forge parso 0.8.2 pyhd8ed1ab_0 conda-forge patsy 0.5.1 pypi_0 pypi pcre 8.45 h0e60522_0 conda-forge pickleshare 0.7.5 py_1003 conda-forge pillow 8.3.1 pypi_0 pypi pip 21.2.4 pyhd8ed1ab_0 conda-forge pixman 0.40.0 h8ffe710_0 conda-forge prometheus_client 0.11.0 pyhd8ed1ab_0 conda-forge prompt-toolkit 3.0.19 pyha770c72_0 conda-forge pthread-stubs 0.4 hcd874cb_1001 conda-forge pycparser 2.20 pyh9f0ad1d_2 conda-forge pygments 2.10.0 pyhd8ed1ab_0 conda-forge pymc3 3.11.3 pypi_0 pypi pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge pyrsistent 0.17.3 py39hb82d6ee_2 conda-forge python 3.9.6 h7840368_1_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-graphviz 0.17 pyhaef67bd_0 conda-forge python_abi 3.9 2_cp39 conda-forge pytz 2021.1 pypi_0 pypi pywin32 301 py39hb82d6ee_0 conda-forge pywinpty 1.1.3 py39h99910a6_0 conda-forge pyzmq 22.2.1 py39he46f08e_0 conda-forge scipy 1.7.1 py39hc0c34ad_0 conda-forge semver 2.13.0 pypi_0 pypi send2trash 1.8.0 pyhd8ed1ab_0 conda-forge setuptools 57.4.0 py39hcbf5309_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge sqlite 3.36.0 h8ffe710_0 conda-forge statsmodels 0.12.2 pypi_0 pypi terminado 0.11.1 py39hcbf5309_0 conda-forge testpath 0.5.0 pyhd8ed1ab_0 conda-forge theano-pymc 1.1.2 pypi_0 pypi tornado 6.1 py39hb82d6ee_1 conda-forge traitlets 5.0.5 py_0 conda-forge typing-extensions 3.10.0.0 pypi_0 pypi tzdata 2021a he74cb21_1 conda-forge ucrt 10.0.20348.0 h57928b3_0 conda-forge vc 14.2 hb210afc_5 conda-forge vs2015_runtime 14.29.30037 h902a5da_5 conda-forge wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge webencodings 0.5.1 py_1 conda-forge wheel 0.37.0 pyhd8ed1ab_1 conda-forge winpty 0.4.3 4 conda-forge xarray 0.19.0 pypi_0 pypi xorg-kbproto 1.0.7 hcd874cb_1002 conda-forge xorg-libice 1.0.10 hcd874cb_0 conda-forge xorg-libsm 1.2.3 hcd874cb_1000 conda-forge xorg-libx11 1.7.2 hcd874cb_0 conda-forge xorg-libxau 1.0.9 hcd874cb_0 conda-forge xorg-libxdmcp 1.1.3 hcd874cb_0 conda-forge xorg-libxext 1.3.4 hcd874cb_1 conda-forge xorg-libxpm 3.5.13 hcd874cb_0 conda-forge xorg-libxt 1.2.1 hcd874cb_2 conda-forge xorg-xextproto 7.3.0 hcd874cb_1002 conda-forge xorg-xproto 7.0.31 hcd874cb_1007 conda-forge xz 5.2.5 h62dcd97_1 conda-forge zeromq 4.3.4 h0e60522_0 conda-forge zipp 3.5.0 pyhd8ed1ab_0 conda-forge zlib 1.2.11 h62dcd97_1010 conda-forge zstd 1.5.0 h6255e5f_0 conda-forge