Closed
Description
Notebook title: GLM: Robust Linear Regression
Notebook url: https://github.com/pymc-devs/pymc-examples/blob/main/examples/generalized_linear_models/GLM-robust.ipynb
Issue description
normal_dist = pm.Normal.dist(mu=0, sigma=1)
t_dist = pm.StudentT.dist(mu=0, lam=1, nu=1)
x_eval = np.linspace(-8, 8, 300)
plt.plot(x_eval, theano.tensor.exp(normal_dist.logp(x_eval)).eval(), label="Normal", lw=2.0)
plt.plot(x_eval, theano.tensor.exp(t_dist.logp(x_eval)).eval(), label="Student T", lw=2.0)
plt.xlabel("x")
plt.ylabel("Probability density")
plt.legend();
Error:
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
Input In [8], in <cell line: 4>()
2 t_dist = pm.StudentT.dist(mu=0, lam=1, nu=1)
3 x_eval = np.linspace(-8, 8, 300)
----> 4 plt.plot(x_eval, theano.tensor.exp(normal_dist.logp(x_eval)).eval(), label="Normal", lw=2.0)
5 plt.plot(x_eval, theano.tensor.exp(t_dist.logp(x_eval)).eval(), label="Student T", lw=2.0)
6 plt.xlabel("x")
File ~/miniforge3/envs/pymc-ex/lib/python3.10/site-packages/theano/graph/basic.py:554, in Variable.eval(self, inputs_to_values)
552 inputs = tuple(sorted(inputs_to_values.keys(), key=id))
553 if inputs not in self._fn_cache:
--> 554 self._fn_cache[inputs] = theano.function(inputs, self)
555 args = [inputs_to_values[param] for param in inputs]
557 rval = self._fn_cache[inputs](*args)
File ~/miniforge3/envs/pymc-ex/lib/python3.10/site-packages/theano/compile/function/__init__.py:337, in function(inputs, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input)
331 fn = orig_function(
332 inputs, outputs, mode=mode, accept_inplace=accept_inplace, name=name
333 )
334 else:
335 # note: pfunc will also call orig_function -- orig_function is
336 # a choke point that all compilation must pass through
--> 337 fn = pfunc(
338 params=inputs,
339 outputs=outputs,
340 mode=mode,
341 updates=updates,
342 givens=givens,
343 no_default_updates=no_default_updates,
344 accept_inplace=accept_inplace,
345 name=name,
346 rebuild_strict=rebuild_strict,
347 allow_input_downcast=allow_input_downcast,
348 on_unused_input=on_unused_input,
349 profile=profile,
350 output_keys=output_keys,
351 )
352 return fn
File ~/miniforge3/envs/pymc-ex/lib/python3.10/site-packages/theano/compile/function/pfunc.py:524, in pfunc(params, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input, output_keys)
519 si = In(
520 variable=sv, value=sv.container, mutable=False, borrow=True, shared=True
521 )
522 inputs.append(si)
--> 524 return orig_function(
525 inputs,
526 cloned_outputs,
527 mode,
528 accept_inplace=accept_inplace,
529 name=name,
530 profile=profile,
531 on_unused_input=on_unused_input,
532 output_keys=output_keys,
533 )
File ~/miniforge3/envs/pymc-ex/lib/python3.10/site-packages/theano/compile/function/types.py:1981, in orig_function(inputs, outputs, mode, accept_inplace, name, profile, on_unused_input, output_keys)
1970 m = Maker(
1971 inputs,
1972 outputs,
(...)
1978 name=name,
1979 )
1980 with config.change_flags(compute_test_value="off"):
-> 1981 fn = m.create(defaults)
1982 finally:
1983 t2 = time.time()
File ~/miniforge3/envs/pymc-ex/lib/python3.10/site-packages/theano/compile/function/types.py:1836, in FunctionMaker.create(self, input_storage, trustme, storage_map)
1833 start_import_time = theano.link.c.cmodule.import_time
1835 with config.change_flags(traceback__limit=config.traceback__compile_limit):
-> 1836 _fn, _i, _o = self.linker.make_thunk(
1837 input_storage=input_storage_lists, storage_map=storage_map
1838 )
1840 end_linker = time.time()
1842 linker_time = end_linker - start_linker
File ~/miniforge3/envs/pymc-ex/lib/python3.10/site-packages/theano/link/basic.py:266, in LocalLinker.make_thunk(self, input_storage, output_storage, storage_map)
265 def make_thunk(self, input_storage=None, output_storage=None, storage_map=None):
--> 266 return self.make_all(
267 input_storage=input_storage,
268 output_storage=output_storage,
269 storage_map=storage_map,
270 )[:3]
File ~/miniforge3/envs/pymc-ex/lib/python3.10/site-packages/theano/link/vm.py:1188, in VMLinker.make_all(self, profiler, input_storage, output_storage, storage_map)
1185 else:
1186 post_thunk_clear = None
-> 1188 vm = self.make_vm(
1189 order,
1190 thunks,
1191 input_storage,
1192 output_storage,
1193 storage_map,
1194 post_thunk_clear,
1195 computed,
1196 compute_map,
1197 self.updated_vars,
1198 )
1200 vm.storage_map = storage_map
1201 vm.compute_map = compute_map
File ~/miniforge3/envs/pymc-ex/lib/python3.10/site-packages/theano/link/vm.py:893, in VMLinker.make_vm(self, nodes, thunks, input_storage, output_storage, storage_map, post_thunk_clear, computed, compute_map, updated_vars)
890 pre_call_clear = [storage_map[v] for v in self.no_recycling]
892 try:
--> 893 from theano.link.c.cvm import CVM
894 except (MissingGXX, ImportError):
895 CVM = None
File ~/miniforge3/envs/pymc-ex/lib/python3.10/site-packages/theano/link/c/cvm.py:13, in <module>
9 if not config.cxx:
10 raise MissingGXX(
11 "lazylinker will not be imported if theano.config.cxx is not set."
12 )
---> 13 from theano.link.c import lazylinker_c
15 class CVM(lazylinker_c.CLazyLinker, VM):
16 def __init__(self, fgraph, *args, **kwargs):
File ~/miniforge3/envs/pymc-ex/lib/python3.10/site-packages/theano/link/c/lazylinker_c.py:157, in <module>
153 _logger.info(f"New version {lazylinker_ext._version}")
155 from lazylinker_ext.lazylinker_ext import * # noqa
--> 157 assert force_compile or (version == get_version())
AssertionError:
Note that this issue tracker is about the contents in the notebooks, if
the notebook is instead triggering a bug or error in pymc, please
report to https://github.com/pymc-devs/pymc/issues instead
Expected output
If applicable, describe what should happen instead.
Proposed solution
If applicable, explain possible solutions and workarounds.
Metadata
Metadata
Assignees
Labels
No labels