Get startedGet started for free

Comparing models with WAIC

Now that you have successfully built the first, basic model, you take another look at the data at your disposal. You notice a variable called wind_speed. This could be a great predictor of the numbers of bikes rented! Cycling against the wind is not that much fun, is it?

You fit another model with this additional predictor:

formula = "num_bikes ~ temp + work_day + wind_speed"

with pm.Model() as model_2:
    pm.GLM.from_formula(formula, data=bikes)
    trace_2 = pm.sample(draws=1000, tune=500)

Is your new model_2 better than model_1, the one without wind speed? Compare the two models using Widely Applicable Information Criterion, or WAIC, to find out!

Both trace_1 and trace_2 are available in your workspace, and pycm3 has been imported as pm.

This exercise is part of the course

Bayesian Data Analysis in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Gather trace_1 and trace_2 into a dictionary
traces_dict = ____
Edit and Run Code