Random walk MH sampler usually converge to the typical set very very slowly in high dimension, thus it becomes a good practices to discard the first few thousand samples that are not yet in the typical set.
I’m having a problem with the above code (from the book/github site) and I can’t tell if it’s because of a version change or something else. When entering those same 3 lines of code I get an error for burned_trace = trace[1000:] KeyError: slice(1000, None, None)
Any suggestions?
If you are using a newer version of pymc (e.g., >=4.0.0), then pm.sample() defaults to returning a trace of a new type (an arviz InferenceData object). So your handling of the trace will need to change accordingly. See here.