Session Ready
Exercise

Calculating variability in model coefficients

In this lesson, you'll re-run the cross-validation routine used before, but this time paying attention to the model's stability over time. You'll investigate the coefficients of the model, as well as the uncertainty in its predictions.

Begin by assessing the stability (or uncertainty) of a model's coefficients across multiple CV splits. Remember, the coefficients are a reflection of the pattern that your model has found in the data.

An instance of the Linear regression object (model) is available in your workpsace. Also, the arrays X and y (the data) are available too.

Instructions 1/2
undefined XP
  • 1
  • 2
  • Initialize a TimeSeriesSplit cross-validation object
  • Create an array of all zeros to collect the coefficients.
  • Iterate through splits of the cross-validation object. On each iteration:
  • Fit the model on training data
  • Collect the model's coefficients for analysis later