Week 1 Assignment – Grading Error: "series_valid not defined"

I’m experiencing a grading issue with the Week 1 assignment. When I submit my notebook, I receive an error that says:

“There was a problem compiling the code from your notebook, please check that you saved before submitting. Details: name ‘series_valid’ is not defined.”

I have followed all the instructions carefully and have only modified the code between the designated markers (### START CODE HERE ### and ### END CODE HERE ###) without altering any provided instructions or code outside these markers. In particular:

  • My train_val_split function correctly defines time_valid and series_valid.
  • All unittests pass when I run the notebook locally.
  • I have restarted the kernel, refreshed the notebook, and saved a fresh copy before submitting.

Despite all this, the grader still reports that series_valid is undefined. I suspect this might be due to how the grader compiles the notebook. Has anyone else experienced this issue, or does anyone have further suggestions to resolve it? Please help me Ill send you my code in the DM PLEASE HELP

Did you add any “import” statements?

Nope as is. Would you be so kind enough to check my work ? I can send you the document through email because I gave up

Sorry, I’m not a mentor for that course, so I don’t have access to the reference solution.

But check your personal messages for a suggestion.

1 Like

I’ve looked at the notebook, and I wasn’t able to see any issues. Hopefully a mentor for that course can help with this.

1 Like

Please first go through the below post comment link to debug your codes

make sure you go point by point, and still if you encounter the same submission let me know. Then I will go through your codes.

You had sent me multiple dms without notifying me here. Please don’t send DMs until mentors ask you for codes.

This way it helps me also not to miss and confuse the notification and getting the right way of help.

Let me know of your progress.

1 Like

I read through the posts and tried them. Did not work. Please help

ok send screenshot of the grade cell in one DM. please make sure to take a proper screenshot.

1 Like

hi @madhunter

in the previous comment where I mentioned a linked comment. please refer point7 and point 8 where your codes are incorrect.

You have hard coded the past series. your code would be same as naive forecast except you use 365 as you are calculating from the previous cycle in the original time series. please don’t use any len function for past series or smooth past series.

for smooth past series, use the correct split of series
as window size is 11. As you know 370 is seasonality plus the noise, window size of 11, gives 359, hence the correct split would be
(SERIES[SPLIT_TIME - 370:-359], 11)

let me know if issue still persist

Great now it works! Thanks

1 Like

you will come across further similar exercise where when series is mentioned you aren’t supposed to use range, but mention the set range assigned to the series which len function can cause issue in these case but that doesn’t mean you cannot use in time series.

In the assignment you worked or will work, understanding the forecast detection is based on a set range and how the time split is determined based on the trend and seasonality.

Keep Learning!

Regards
DP