When running Inference on Galton Board, I get the following error when calculating samples_0 and samples_1:
KeyError Traceback (most recent call last)
File /usr/local/Caskroom/miniforge/base/envs/new/lib/python3.10/site-packages/autograd/core.py:233, in vspace(value)
232 try:
--> 233 return VSpace.mappingstype(value)
234 except KeyError:
KeyError: <class 'int'>
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
Cell In [16], line 1
----> 1 samples_0, _, scores_0, _ = galton_rvs(theta_0, n_runs=20000, random_state=1234)
2 p_estimated_0, _ = np.histogram(samples_0, bins=n_nails, range=(0, n_nails), density=True)
4 samples_1, _, scores_1, _ = galton_rvs(theta_1, n_runs=20000, random_state=1234)
File :13, in galton_rvs(theta, n_runs, n_rows, n_nails, random_state)
File /usr/local/Caskroom/miniforge/base/envs/new/lib/python3.10/site-packages/autograd/wrap_util.py:20, in unary_to_nary..nary_operator..nary_f(*args, **kwargs)
18 else:
19 x = tuple(args[i] for i in argnum)
---> 20 return unary_operator(unary_f, x, *nary_op_args, **nary_op_kwargs)
File /usr/local/Caskroom/miniforge/base/envs/new/lib/python3.10/site-packages/autograd/differential_operators.py:147, in grad_and_aux(fun, x)
144 """Builds a function that returns the gradient of the first output and the
145 (unmodified) second output of a function that returns two outputs."""
146 vjp, (ans, aux) = _make_vjp(lambda x: atuple(fun(x)), x)
--> 147 return vjp((vspace(ans).ones(), vspace(aux).zeros())), aux
File /usr/local/Caskroom/miniforge/base/envs/new/lib/python3.10/site-packages/autograd/core.py:233, in vspace(value)
231 def vspace(value):
232 try:
--> 233 return VSpace.mappingstype(value)
234 except KeyError:
235 if isbox(value):
File /usr/local/Caskroom/miniforge/base/envs/new/lib/python3.10/site-packages/autograd/builtins.py:124, in ContainerVSpace.init(self, value)
122 def init(self, value):
123 self.shape = value
--> 124 self.shape = self._map(vspace)
File /usr/local/Caskroom/miniforge/base/envs/new/lib/python3.10/site-packages/autograd/builtins.py:151, in SequenceVSpace._map(self, f, *args)
150 def _map(self, f, *args):
--> 151 return self.seq_type(map(f, self.shape, *args))
File /usr/local/Caskroom/miniforge/base/envs/new/lib/python3.10/site-packages/autograd/core.py:238, in vspace(value)
236 return vspace(getval(value))
237 else:
--> 238 raise TypeError("Can't find vector space for value {} of type {}. "
239 "Valid types are {}".format(
240 value, type(value), VSpace.mappings.keys()))
TypeError: Can't find vector space for value 15 of type <class 'int'>. Valid types are dict_keys([<class 'autograd.core.SparseObject'>, <class 'list'>, <class 'tuple'>, <class 'dict'>, <class 'numpy.ndarray'>, <class 'float'>, <class 'numpy.float64'>, <class 'numpy.float32'>, <class 'numpy.float16'>, <class 'complex'>, <class 'numpy.complex64'>, <class 'numpy.complex128'>])
My conda environment is:
active environment : new
active env location : /usr/local/Caskroom/miniforge/base/envs/new
shell level : 1
user config file : /Users/mrenna/.condarc
populated config files : /usr/local/Caskroom/miniforge/base/.condarc
/Users/mrenna/.condarc
conda version : 4.14.0
conda-build version : not installed
python version : 3.9.13.final.0
virtual packages : __osx=12.5.1=0
__unix=0=0
__archspec=1=x86_64
base environment : /usr/local/Caskroom/miniforge/base (writable)
conda av data dir : /usr/local/Caskroom/miniforge/base/etc/conda
conda av metadata url : None
channel URLs : https://conda.anaconda.org/conda-forge/osx-64
https://conda.anaconda.org/conda-forge/noarch
package cache : /usr/local/Caskroom/miniforge/base/pkgs
/Users/mrenna/.conda/pkgs
envs directories : /usr/local/Caskroom/miniforge/base/envs
/Users/mrenna/.conda/envs
platform : osx-64
user-agent : conda/4.14.0 requests/2.28.1 CPython/3.9.13 Darwin/21.6.0 OSX/12.5.1
UID:GID : 502:20
netrc file : None
offline mode : False
Any advice on how to debug this or to test if my environment is broken?
I tried using v1.3 of autograd, but this did not change the result.