Skip to Content
Hands-On Machine Learning for Algorithmic Trading
book

Hands-On Machine Learning for Algorithmic Trading

by Stefan Jansen
December 2018
Beginner to intermediate
684 pages
21h 9m
English
Packt Publishing
Content preview from Hands-On Machine Learning for Algorithmic Trading

Posterior Predictive Checks

Posterior Predictive Checks (PPCs) are very useful for examining how well a model fits the data. They do so by generating data from the model using parameters from draws from the posterior. We use the pm.sample_ppc function for this purpose and obtain n samples for each observation (the GLM module automatically names the outcome 'y'):

ppc = pm.sample_ppc(trace_NUTS, samples=500, model=logistic_model)ppc['y'].shape(500, 29170)

We can evaluate the in-sample fit using the auc score, for example, to compare different models:

roc_auc_score(y_score=np.mean(ppc['y'], axis=0),               y_true=data.income)0.8294958565103577
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Machine Learning for Algorithmic Trading - Second Edition

Machine Learning for Algorithmic Trading - Second Edition

Stefan Jansen

Publisher Resources

ISBN: 9781789346411Supplemental Content