Trace slice error: "Stop value in slice not suported"


#1

Hi everyone,
I am trying to do something like:

with model:
    trace = pm.backends.text.load('trace')
trace_truncated = trace[start:stop]

but I am getting ValueError: Stop value in slice not supported.

Any suggestion how to get slice like the one above?

Thanks :slight_smile:


#2

If you refer the source (of PyMC3) you can observe that this error can be avoided only by setting the stop value in the slice to none. It seems for some reason PyMC3 does not support slicing the stop index.

I’m very curious to know why isn’t it supported?
@junpenglao any ideas?


#3

Not sure as well. Something to do with the text file format?
We have been planning to improve the trace backend to something more robust for a while now…