I don’t understand why such a simple example would go wrong.Help~~~~
mu = np.zeros(3)
true_cov = np.array([[1.0, 0.5, 0.1],
[0.5, 2.0, 0.2],
[0.1, 0.2, 1.0]])
data = np.random.multivariate_normal(mu, true_cov, 10)
with pm.Model() as model_allcate:
sd_dist = pm.HalfCauchy.dist(beta=2.5, shape=3)
chol_packed = pm.LKJCholeskyCov('chol_packed', n=3, eta=2, sd_dist=sd_dist)
chol = pm.expand_packed_triangular(3, chol_packed)
vals = pm.MvNormal('vals', mu=mu, chol=chol, observed=data)
trace=pm.sample(1)
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\subtensor.py:2197: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
rval = inputs[0].__getitem__(inputs[1:])
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\subtensor.py:2339: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
out[0][inputs[2:]] = inputs[1]
Only 1 samples in chain.
Auto-assigning NUTS sampler...
Initializing NUTS using jitter+adapt_diag...
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\basic.py:6592: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
result[diagonal_slice] = x
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\subtensor.py:2339: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
out[0][inputs[2:]] = inputs[1]
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\subtensor.py:2197: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
rval = inputs[0].__getitem__(inputs[1:])
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in compile_args(self)
965 try:
--> 966 ret += x.c_compile_args(c_compiler)
967 except TypeError:
TypeError: c_compile_args() takes 1 positional argument but 2 were given
During handling of the above exception, another exception occurred:
AssertionError Traceback (most recent call last)
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\blas.py in _ldflags(ldflags_str, libs, flags, libs_dir, include_dir)
443 t0, t1, t2 = t[0:3]
--> 444 assert t0 == '-'
445 except Exception:
AssertionError:
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-930-88f9299b1080> in <module>
10 vals = pm.MvNormal('vals', mu=mu, chol=chol, observed=data)
11
---> 12 pm.sample(1)
E:\ProgramData\Anaconda3\lib\site-packages\pymc3\sampling.py in sample(draws, step, init, n_init, start, trace, chain_idx, chains, cores, tune, nuts_kwargs, step_kwargs, progressbar, model, random_seed, live_plot, discard_tuned_samples, live_plot_kwargs, compute_convergence_checks, use_mmap, **kwargs)
393 start_, step = init_nuts(init=init, chains=chains, n_init=n_init,
394 model=model, random_seed=random_seed,
--> 395 progressbar=progressbar, **args)
396 if start is None:
397 start = start_
E:\ProgramData\Anaconda3\lib\site-packages\pymc3\sampling.py in init_nuts(init, chains, n_init, model, random_seed, progressbar, **kwargs)
1513 'Unknown initializer: {}.'.format(init))
1514
-> 1515 step = pm.NUTS(potential=potential, model=model, **kwargs)
1516
1517 return start, step
E:\ProgramData\Anaconda3\lib\site-packages\pymc3\step_methods\hmc\nuts.py in __init__(self, vars, max_treedepth, early_max_treedepth, **kwargs)
152 `pm.sample` to the desired number of tuning steps.
153 """
--> 154 super(NUTS, self).__init__(vars, **kwargs)
155
156 self.max_treedepth = max_treedepth
E:\ProgramData\Anaconda3\lib\site-packages\pymc3\step_methods\hmc\base_hmc.py in __init__(self, vars, scaling, step_scale, is_cov, model, blocked, potential, integrator, dtype, Emax, target_accept, gamma, k, t0, adapt_step_size, step_rand, **theano_kwargs)
73
74 super(BaseHMC, self).__init__(
---> 75 vars, blocked=blocked, model=model, dtype=dtype, **theano_kwargs
76 )
77
E:\ProgramData\Anaconda3\lib\site-packages\pymc3\step_methods\arraystep.py in __init__(self, vars, model, blocked, dtype, **theano_kwargs)
226
227 func = model.logp_dlogp_function(
--> 228 vars, dtype=dtype, **theano_kwargs)
229
230 # handle edge case discovered in #2948
E:\ProgramData\Anaconda3\lib\site-packages\pymc3\model.py in logp_dlogp_function(self, grad_vars, **kwargs)
708 varnames = [var.name for var in grad_vars]
709 extra_vars = [var for var in self.free_RVs if var.name not in varnames]
--> 710 return ValueGradFunction(self.logpt, grad_vars, extra_vars, **kwargs)
711
712 @property
E:\ProgramData\Anaconda3\lib\site-packages\pymc3\model.py in __init__(self, cost, grad_vars, extra_vars, dtype, casting, **kwargs)
447
448 self._theano_function = theano.function(
--> 449 inputs, [self._cost_joined, grad], givens=givens, **kwargs)
450
451 def set_extra_values(self, extra_vars):
E:\ProgramData\Anaconda3\lib\site-packages\theano\compile\function.py in function(inputs, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input)
315 on_unused_input=on_unused_input,
316 profile=profile,
--> 317 output_keys=output_keys)
318 return fn
E:\ProgramData\Anaconda3\lib\site-packages\theano\compile\pfunc.py in pfunc(params, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input, output_keys)
484 accept_inplace=accept_inplace, name=name,
485 profile=profile, on_unused_input=on_unused_input,
--> 486 output_keys=output_keys)
487
488
E:\ProgramData\Anaconda3\lib\site-packages\theano\compile\function_module.py in orig_function(inputs, outputs, mode, accept_inplace, name, profile, on_unused_input, output_keys)
1839 name=name)
1840 with theano.change_flags(compute_test_value="off"):
-> 1841 fn = m.create(defaults)
1842 finally:
1843 t2 = time.time()
E:\ProgramData\Anaconda3\lib\site-packages\theano\compile\function_module.py in create(self, input_storage, trustme, storage_map)
1713 theano.config.traceback.limit = theano.config.traceback.compile_limit
1714 _fn, _i, _o = self.linker.make_thunk(
-> 1715 input_storage=input_storage_lists, storage_map=storage_map)
1716 finally:
1717 theano.config.traceback.limit = limit_orig
E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\link.py in make_thunk(self, input_storage, output_storage, storage_map)
697 return self.make_all(input_storage=input_storage,
698 output_storage=output_storage,
--> 699 storage_map=storage_map)[:3]
700
701 def make_all(self, input_storage, output_storage):
E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\vm.py in make_all(self, profiler, input_storage, output_storage, storage_map)
1089 compute_map,
1090 [],
-> 1091 impl=impl))
1092 linker_make_thunk_time[node] = time.time() - thunk_start
1093 if not hasattr(thunks[-1], 'lazy'):
E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\op.py in make_thunk(self, node, storage_map, compute_map, no_recycling, impl)
953 try:
954 return self.make_c_thunk(node, storage_map, compute_map,
--> 955 no_recycling)
956 except (NotImplementedError, utils.MethodNotDefined):
957 # We requested the c code, so don't catch the error.
E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\op.py in make_c_thunk(self, node, storage_map, compute_map, no_recycling)
856 _logger.debug('Trying CLinker.make_thunk')
857 outputs = cl.make_thunk(input_storage=node_input_storage,
--> 858 output_storage=node_output_storage)
859 thunk, node_input_filters, node_output_filters = outputs
860
E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in make_thunk(self, input_storage, output_storage, storage_map, keep_lock)
1215 cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
1216 input_storage, output_storage, storage_map,
-> 1217 keep_lock=keep_lock)
1218
1219 res = _CThunk(cthunk, init_tasks, tasks, error_storage, module)
E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in __compile__(self, input_storage, output_storage, storage_map, keep_lock)
1155 output_storage,
1156 storage_map,
-> 1157 keep_lock=keep_lock)
1158 return (thunk,
1159 module,
E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in cthunk_factory(self, error_storage, in_storage, out_storage, storage_map, keep_lock)
1607 """
1608 try:
-> 1609 key = self.cmodule_key()
1610 except KeyError:
1611 key = None
E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in cmodule_key(self)
1295 """
1296 return self.cmodule_key_(self.fgraph, self.no_recycling,
-> 1297 compile_args=self.compile_args(),
1298 libraries=self.libraries(),
1299 header_dirs=self.header_dirs(),
E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in compile_args(self)
966 ret += x.c_compile_args(c_compiler)
967 except TypeError:
--> 968 ret += x.c_compile_args()
969 except utils.MethodNotDefined:
970 pass
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\blas.py in c_compile_args(self)
500
501 def c_compile_args(self):
--> 502 return ldflags(libs=False, flags=True)
503
504 def c_lib_dirs(self):
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\blas.py in ldflags(libs, flags, libs_dir, include_dir)
387 flags=flags,
388 libs_dir=libs_dir,
--> 389 include_dir=include_dir)
390
391
E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\utils.py in rval(*args, **kwargs)
257 key = (args, kwtup)
258 if key not in cache:
--> 259 val = f(*args, **kwargs)
260 cache[key] = val
261 else:
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\blas.py in _ldflags(ldflags_str, libs, flags, libs_dir, include_dir)
445 except Exception:
446 raise ValueError('invalid token "%s" in ldflags_str: "%s"'
--> 447 % (t, ldflags_str))
448 if libs_dir and t1 == 'L':
449 rval.append(t[2:])
ValueError: ('The following error happened while compiling the node', Dot22Scalar(Solve{A_structure='upper_triangular', lower=True, overwrite_A=False, overwrite_b=False}.0, InplaceDimShuffle{1,0}.0, TensorConstant{-1.0}), '\n', 'invalid token "lblas" in ldflags_str: "lblas"')