You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
────────────────────────────────── Errorrunningexamples/case_studies/probabilistic_matrix_factorization.ipynb ──────────────────────────────────
---------------------------------------------------------------------------Exceptionencounteredat"In [20]":
---------------------------------------------------------------------------NotImplementedErrorTraceback (mostrecentcalllast)
CellIn[20], line21# Find MAP for PMF.---->2pmf.find_map();
CellIn[13], line6, in_find_map(self)
4withself.model:
5logging.info("finding PMF MAP using L-BFGS-B optimization...")
---->6self._map=pm.find_MAP(method="L-BFGS-B")
8elapsed=int(time.time() -tstart)
9logging.info("found PMF MAP in %d seconds"%elapsed)
File~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pymc/tuning/starting.py:134, infind_MAP(start, vars, method, return_raw,
include_transformed, progressbar, progressbar_theme, maxeval, model, seed, *args, **kwargs)
127ipfn=make_initial_point_fn(
128model=model,
129jitter_rvs=set(),
130return_transformed=True,
131overrides=start,
132 )
133start=ipfn(seed)
-->134model.check_start_vals(start)
136vars_dict= {var.name: varforvarinvars}
137x0=DictToArrayBijection.map(
138 {var_name: valueforvar_name, valueinstart.items() ifvar_nameinvars_dict}
139 )
File~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pymc/model/core.py:1742, inModel.check_start_vals(self, start, **kwargs)
1736valid_keys=", ".join(value_names_set)
1737raiseKeyError(
1738"Some start parameters do not appear in the model!\n"1739f"Valid keys are: {valid_keys}, but {extra_keys} was supplied"1740 )
->1742initial_eval=self.point_logps(point=elem, **kwargs)
1744ifnotall(np.isfinite(v) forvininitial_eval.values()):
1745raiseSamplingError(
1746"Initial evaluation of model at starting point failed!\n"1747f"Starting values:\n{elem}\n\n"1748f"Logp initial evaluation results:\n{initial_eval}\n"1749"You can call `model.debug()` for more details."1750 )
File~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pymc/model/core.py:1774, inModel.point_logps(self, point, round_vals, **kwargs)
1771point=self.initial_point()
1773factors=self.basic_RVs+self.potentials->1774factor_logps_fn=1775return {
1776factor.name: np.round(np.asarray(factor_logp), round_vals)
1777forfactor, factor_logpinzip(
(...)
1780 )
1781 }
File~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pymc/model/core.py:672, inModel.logp(self, vars, jacobian, sum)
670rv_logps: list[TensorVariable] = []
671ifrvs:
-->672rv_logps=transformed_conditional_logp(
673rvs=rvs,
674rvs_to_values=self.rvs_to_values,
675rvs_to_transforms=self.rvs_to_transforms,
676jacobian=jacobian,
677 )
678assertisinstance(rv_logps, list)
680# Replace random variables by their value variables in potential termsFile~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pymc/logprob/basic.py:595, intransformed_conditional_logp(rvs, rvs_to_values,
rvs_to_transforms, jacobian, **kwargs)
592transform_rewrite=TransformValuesRewrite(values_to_transforms) # type: ignore594kwargs.setdefault("warn_rvs", False)
-->595temp_logp_terms=conditional_logp(
596rvs_to_values,
597extra_rewrites=transform_rewrite,
598use_jacobian=jacobian,
599**kwargs,
600 )
602# The function returns the logp for every single value term we provided to it.603# This includes the extra values we plugged in above, so we filter those we604# actually wanted in the same order they were given in.605logp_terms= {}
File~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pymc/logprob/basic.py:479, inconditional_logp(rv_values, warn_rvs, ir_rewriter,
extra_rewrites, **kwargs)
417r"""Create a map between variables and conditional logps such that the sum is their joint logp. 418 419 The `rv_values` dictionary specifies a joint probability graph defined by (...) 475 476 """477warn_rvs, kwargs=_deprecate_warn_missing_rvs(warn_rvs, kwargs)
-->479fgraph=construct_ir_fgraph(rv_values, ir_rewriter=ir_rewriter)
481ifextra_rewritesisnotNone:
482extra_rewrites.rewrite(fgraph)
File~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pymc/logprob/rewriting.py:249, inconstruct_ir_fgraph(rv_values, ir_rewriter)
246cloned_values=tuple(v.clone() forvinrv_values.values())
247ir_rv_values=dict(zip(fgraph.outputs, cloned_values))
-->249replacements=tuple((rv, valued_rv(rv, value)) forrv, valueinir_rv_values.items())
250toposort_replace(fgraph, replacements, reverse=True)
252ifir_rewriterisNone:
File~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pymc/logprob/rewriting.py:249, in<genexpr>(.0)
246cloned_values=tuple(v.clone() forvinrv_values.values())
247ir_rv_values=dict(zip(fgraph.outputs, cloned_values))
-->249replacements=tuple((rv, valued_rv(rv, value)) forrv, valueinir_rv_values.items())
250toposort_replace(fgraph, replacements, reverse=True)
252ifir_rewriterisNone:
File~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pytensor/graph/op.py:304, inOp.__call__(self, name, return_list, *inputs,
**kwargs)
301n.name=f"{name}_{i}"303ifconfig.compute_test_value!="off":
-->304compute_test_value(node)
306ifself.default_outputisnotNone:
307rval=node.outputsFile~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pytensor/graph/op.py:125, incompute_test_value(node)
122thunk.inputs= [storage_mapforvinnode.inputs]
123thunk.outputs= [storage_mapforvinnode.outputs]
-->125thunk()
127foroutputinnode.outputs:
128# Check that the output has been computed129assertcompute_map[0], (output, storage_map[0])
File~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pytensor/graph/op.py:524, inOp.make_py_thunk.<locals>.rval(p, i, o, n)
522 @is_thunk_type523defrval(p=p, i=node_input_storage, o=node_output_storage, n=node):
-->524r=p(n, [x[0] forxini], o)
525foroinnode.outputs:
526compute_map[0] =TrueFile~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pymc/logprob/abstract.py:245, inValuedRV.perform(self, node, inputs, out)
244defperform(self, node, inputs, out):
-->245raiseNotImplementedError("ValuedVar should not be present in the final graph!")
NotImplementedError: ValuedVarshouldnotbepresentinthefinalgraph!
The text was updated successfully, but these errors were encountered:
Error while finding MAP for the model.
The text was updated successfully, but these errors were encountered: