Skip to content

Instantly share code, notes, and snippets.

@abhijeet-talaulikar
Last active July 6, 2023 06:00
Show Gist options
  • Save abhijeet-talaulikar/d83ed24ee86aacc09fe234b3afff5960 to your computer and use it in GitHub Desktop.
Save abhijeet-talaulikar/d83ed24ee86aacc09fe234b3afff5960 to your computer and use it in GitHub Desktop.
posterior = pm.sample_posterior_predictive(trace, mmm)
predictions = posterior['posterior_predictive']['revenue'].mean(axis=0).mean(axis=0) * media['REVENUE'].mean()
media_decomp = pd.DataFrame({i:np.array(trace['posterior']["contribution_"+str(i)]).mean(axis=(0,1)) for i in channel_priors.keys()}, index=dates) * media['REVENUE'].mean()
plt.plot(media['REVENUE'])
plt.plot(predictions)
plt.title("Model Fit")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment