C4W1 Assignment compiling error resulting in 0 points

Ive been working on the first week assignment and, once i submit i get 0 points and an error saying:
There was a problem compiling the code from your notebook, please check that you saved before submitting. Details:
name ‘time_valid’ is not defined

‘time_valid’ is assigned through the first graded function call and of course i saved the file, i have passed all tests except the last one, im in a hurry as i wanted to conclude the cert before the subscription renewal and so i submitted anyways, knowing i would pass the assignment; but now im stuck as i keep getting 0/80.
Ive already tried refreshing/updating the notebook and rewriting my solutions on it, but the issue persists.
Any help is appreciated, thanks!

hi @edmos7

please follow comment link to debug your codes

passing test doesn’t mean your codes are correct.

Also never be in hurry to get certificate, focus should be on learning. You can contact Coursera Learner Help center if you want a week extension on your subscription with your reason of delay. They might or might not extend (this is only if you have paid subscription and not financial aid subscription)

Please make sure not to post any codes here as it’s against community guidelines.

Regards
DP

Hello, thank you for the answer, but the error doesnt seem to be related to the functions. I have also disconnected and reconnected the kernel and reran the code before submitting, but i still got 0.
Anyways, may i send you the last function code? I cant figure out what im getting wrong, thanks.

did you check if the code points mentioned in the linked post is written in same way in your notebook too?

If you mean getting the same error for all cells, yes, im getting that error on all the cell gradings

No I mean did you read the linked post comment where it mentions how the code should be written for each grade cell?.

the error shown for your assignment is pointing that one or other codes has been not recalled as per the autograder.

Like using an incorrect function, or using global variable instead of local variable.

So go through that post first point by point and check if you have recalled your codes same way.

Ive gone through and checked the codes, but i still got 0/80

ok click on my name and then message. Please send screenshots of grade cell codes only.

Regards
DP

hi @edmos7

When you do now correction please make sure to get a fresh copy of assignment and only write codes between assigned markers ###START AND END CODE HERE### and making sure not to delete the already given instructions and do not add your own way of writing the codes.

You suppose to only replace None placed between the Markers ###START AND END CODE HERE### without editing the already given instructions or part of codes already given to you when you first open the assignment notebook. By following this, your are preventing any grade failure as per autograder.

Now comes to your code as per each grade cell.

  1. Your train_val_split codes are correct.

  2. Your compute metrics codes are correct.

  3. Your error in codes starts from naive forecast where you seems to have done editing and hard-coded the path. According to the instructions given, you are suppose to use the whole SERIES (training and validation) and the SPLIT_TIME to compute naive forecast. So this code is in single line where you use the SERIES and apply to [SPLIT_TIME - 1:-1]

  4. Next in moving average forecast, your range code is incorrect. You are suppose to use len function to arg (series) - window_size.
    Then when you forecast.append to (series[time:time + window_size].mean())

  5. In diff series calculation, you have again hard coded the path. Instructions given is
    Since the seasonality period is 365 days, we will subtract the value at time t – 365 from the value at time t.
    Define the diff_series and diff_time variables below to achieve this. Notice that diff_time is the values of the x-coordinate for diff_series.
    So diff series would be (SERIES[365:] - SERIES[:-365]) and diff time would be TIME[365:]

  6. for diff moving avg, your code are incorrect for
    Perform the correct slicing where you used len function to the series and split but you had to use [SPLIT_TIME - 365 - WINDOW_SIZE:] to the diff moving avg.

  7. For past series, the code is same way I mentioned for naive forecast but the value here would 365 instead of 1 as we are calculating the seasonality from previous cycle in the original time series.

  8. Smooth past series codes I didn’t see but just a heads for you to debug yourself, please don’t use any len function here :crazy_face:. Just use the SERIES AND SPLIT TIME CORRECTLY WITH WINDOW_SIZE of 11, so SPLIT TIME would be subtracted from 370:-359 as WINDOW SIZE is 11.

I hope you know how to get a fresh copy of assignment, in case you don’t let me know.

Regards
DP

1 Like

Your detailed guidance really helped me also with debugging my code. Thankyou, I appreciate.

1 Like

I also had the same error, that series_valid was not defined and 0%. After correcting the third exercise as you adviced I got 100%. Thank you.

1 Like