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.
Este exercício faz parte do curso
Bayesian Data Analysis in Python
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Gather trace_1 and trace_2 into a dictionary
traces_dict = ____