C4_W1_Assignment correct slicing

hi,

I’m working through C4_W1 Assignment. I’m on the section:
“Define the diff_moving_avg variable.
**Notice that the window_size has already being defined and that you will need to perform the correct slicing for the series to match the validation period.**”

Specifically, I’m working on this line:
# Perform the correct slicing
diff_moving_avg = diff_moving_avg[None:]

From the hint, it implies that the window_size has already been defined in the assignment template, however, it has not been defined.

Any suggestions, would be helpful.

Thank you,
Ed

1 Like

Hey Ed!

Excellent question!

Let’s just clear a few things up here!

window_size is defined because we’re given this: diff_moving_avg = moving_average_forecast(None, 50) code snippet.

If we reference the function signature, provided a few code cells above, we find this: moving_average_forecast(SERIES, window_size=30).

So from that we can infer that window_size is defined to be 50.

Now, keep in mind, that we’re working with a subset of the data, and some seasonality, so we’ll want to factor those things into our slicing - as well as the window size.

Hopefully this helps!

Please reach out if you have any further questions!

1 Like