Commit 839206b6 authored by Robert P. Goldman's avatar Robert P. Goldman Committed by Robert P. Goldman

Fix issue 3840.

Previously, if the argument to sample_posterior_predictive was a list of points, AND the samples argument was not supplied, then spp would error out, because the code for computing samples assumed that the trace argument was a MultiTrace.
parent b5660603
......@@ -1568,7 +1568,13 @@ def sample_posterior_predictive(
raise IncorrectArgumentsError("Should not specify both keep_size and size argukments")
if samples is None:
samples = sum(len(v) for v in trace._straces.values())
if isinstance(trace, MultiTrace):
samples = sum(len(v) for v in trace._straces.values())
elif isinstance(trace, list) and all((isinstance(x, dict) for x in trace)):
# this is a list of points
samples = len(trace)
else:
raise ValueError("Do not know how to compute number of samples for trace argument of type %s"%type(trace))
if samples < len_trace * nchain:
warnings.warn(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment