Assignment C4W1 does not pass the test even if all tests are correct 'time_valid' is not defined

C4W1 ASSIGNMENT ‘time_valid’ is not defined
I have a problem with the C4W1 assignment, I pass all the tests and I get 0 points, it says that time_valid is not defined, in my function time_valid I am using the slicing with the number 1100 not with SPLIT_TIME, any idea what could be happening? I have been using this notebook for 6 days without finding a solution even though all the tests pass the test without any problem.

Hi @sam888

Go through below post comment to debug your codes

Solution post comment

this error happen usually when variables were used incorrectly even if you passed all the unit test

I have already read this comment, excuse my ignorance but how can I make a new copy of the assignment? in the middle of trying to solve the debugging problems I made several changes in the original notebook.

How to get fresh copy

I already updated the notebook, I did it all again taking into account only to make code in the parts that should be done without modifying the rest of the code, I still get the same error, I can write you personally and tell me if there is a problem with my code? I keep passing all the tests and it qualifies with 0

you can DM me screenshot of the grade cell codes

There are two issues with your codes

  1. in train_val_split, you have used value instead of variables

  2. your past series codes are still incorrect, refer the previous solution post comment to do the correct.

Your slicing to get the past values is incorrect.

Instruction given
Now let’s bring back the trend and seasonality by adding the past values from t – 365. For each value you want to forecast, you will be adding the exact same point, but from the previous cycle in the original time series

so when you used SERIES, to get the past values, t is your SPLIT TIME - 365 which is the same point, but from previous cycle in the original time series, to the past values t - 365

Here you have use len function to the time valid which is not required

you basically have added two sets of trend and seasonality and added the time valid which is incorrect as you used SPLIT_TIME twice.

1 Like

I was able to resolve the error, I am truly grateful

1 Like