13.08.2022 Views

advanced-algorithmic-trading

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

58

sns.lmplot(x="x", y="y", data=df, size=10)

plt.xlim(0.0, 1.0)

trace = glm_mcmc_inference(df, iterations=5000)

pm.traceplot(trace[500:])

plt.show()

# Plot a sample of posterior regression lines

sns.lmplot(x="x", y="y", data=df, size=10, fit_reg=False)

plt.xlim(0.0, 1.0)

plt.ylim(0.0, 4.0)

pm.glm.plot_posterior_predictive(trace, samples=100)

x = np.linspace(0, 1, N)

y = beta_0 + beta_1*x

plt.plot(x, y, label="True Regression Line", lw=3., c="green")

plt.legend(loc=0)

plt.show()

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!