Skip to content

Instantly share code, notes, and snippets.

@jdmoore7
Created December 8, 2021 17:35
Show Gist options
  • Save jdmoore7/82cffa9ab3674378fc3652d9b1ef064a to your computer and use it in GitHub Desktop.
Save jdmoore7/82cffa9ab3674378fc3652d9b1ef064a to your computer and use it in GitHub Desktop.
Posterior plots
import random
def post_plot(trace_obj=trace,samples=100,size=len(X)):
for itr in range(samples):
idx = random.choice(range(size))
m = trace_obj.get_values('m')[idx]
b = trace_obj.get_values('b')[idx]
Y_hat = np.exp(m*X + b)
plt.plot(X,Y_hat)
plt.scatter(X,Y)
post_plot()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment