Why the series_valid is not defined

week-1 #deeplearning_ai_tensorflow_developer Week 1 Assignment 1:

Having problems granding assignment:
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 did get a new version of the notebook and tried known to me remediation steps. What would you advise?

Thanks a lot!



screenshot removed as it contains grade cell codes. A mentor will ask you, if they want to review your codes by personal DM, posting codes, sharing links to notebook is against community guidelines
Cuplikan layar 2024-10-29 080347

go through the below comment to debug your codes

I still don’t understand and I’ve tried restarting the notebook but it still doesn’t work

did you go through the codes mentioned on how to write in each grade cell?

check the pinned comment.

I’m still confused as to why the results are still like that. Maybe I can send my notebook and code to check directly or if there are any other suggestions

you are not suppose to just refresh your notebook, open the pinned comment which mentions how each code should be written, the most probable reason for series_valid not defined some when were you had to use a series variable, you must have used incorrect variable, like instead of global variable you used local variable or vice versa. The pinned comment I shared mentions that.

Refreshing your notebook will not resolve your issue.

I’ve tried using global variables, but the results are still wrong

please DM your codes screenshots. Click on my name and then message @Aswin_Setiawan

Yes sir, I have dm to your account

hi @Aswin_Setiawan

Kindly get a fresh copy of assignment and re-do the assignment by making sure not to hard code path to any of the already given function when you start the assignment.

Your codes for compute metrics is incorrect. kindly do not hard code the path, also use tf.keras.Losses.MSE/MAE function to do the metrics. You also do not need to use the conversion tf datatype for that cell.

next in your diff moving average forecast, perform slicing code is incorrect.

Next your smooth past series code is also hard coded. Refer the pinned comment to do the correction

Remember getting a fresh copy means, either renaming the assignment copy you have done or deleting this copy and then rebooting, and updating lab, gets you a fresh copy.

I usually prefer to delete all the files and then get a fresh copy to avoid any resubmission failure as some previous file still have caused submission failure for me.

Also not to forget when this time you re do the assignment, only write codes as per the instructions already given, do not add any more extra code lines for successful submission.
Regards
DP

Hi!

I seem to get the same problem: The grader gets a compilation problem, even though when I run the notebook myself all tests passed.

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

But the series_valid variable is defined in the frozen cell with row:
“time_train, series_train, time_valid, series_valid = train_val_split(TIME, SERIES)”

I’ve tried to reset the workspace as mentioned in https://www.coursera.org/learn/tensorflow-sequences-time-series-and-prediction/supplement/F77WP/optional-downloading-your-notebook-and-refreshing-your-workspace, I do not find where to “Update the lab” though. The same problem persists.

I’ve also tried to reboot the server, but the same problem keeps popping up.

This is for the C4W1_Assignment.ipynb.

Best,
Christian

Update labs is when you click :question:, you only see update lab if you are working on older version. but in case you want to grab a fresh copy, then either rename the assignment copy you worked on or delete it from file==>Open section. if you delete the file, you notice a 404 error on the browser, then click :question:again, reboot the lab, and get a fresh copy.

ok, so if I understand correct, the “Update lab” step in refreshing the workspace can then be ignored, if I’ve renamed the workspace, clicked “Get the lastest version” and then re-applied the assignment code again.

In that case I must have followed the instruction on how to refresh the workspace, but still get the problem with compiler error from the grader.

I usually prefer to update lab if I am trying to get a fresh copy, just to make sure I am working on the latest version. But if you are working on latest version you can ignore.

that’s because you are not going through the points I mentioned in the pinned comment on how to debug your codes. I have mentioned each grade cell codes correction. when you get a fresh copy, make sure you read the instructions points carefully in my previous pinned comment response to edmos

I now tried to refresh the lab again by renaming and resetting. I then only updated the None values on these lines in the very first code cell, between the START CODE HERE and END CODE HERE marks:

    ### START CODE HERE ###
    # Get train split
    time_train = None
    series_train = None
    # Get validation split
    time_valid = None
    series_valid = None
    ### END CODE HERE ###

(I do not post the actual code here as I understand that is against the policy on this forum, but they are one liners using python slicer)

When running everything up to and include the code cell with # Test your code!, the result is “All tests passed!”.

However, after saving and then clicking “Submit assignment”, the train_val_split section gets 0/10 points earned with the new error message: “There was a problem compiling the code from your notebook, please check that you saved before submitting. Details: ‘NoneType’ object is not iterable”

Best,
Christian

what about other grade function, you probably have the same information for the other grade function. So passing unittest cell doesn’t mean your codes are correct.

that grader output seems more in general.

Did you go through the pinned comment I shared?

Now I debugged it further by using the # grade-up-to-here comment and apply it to each graded cell one by one. I managed to get train_val_split to work by marking it with # grade-up-to-here. The error message:

“There was a problem compiling the code from your notebook, please check that you saved before submitting. Details: ‘NoneType’ object is not iterable” is therefore from another cell, even though the train_val_split works, the grader will give a compile error for it anyway."

I managed to reproduce the original error message by using a for-loop to solve the naive_forecast case:

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

from the train_val_split was therefore because of a for-loop in a different cell.

I also got the error:

“Grader Error: Grader feedback not found
Visit the Discussion forum to see if your peers are experiencing or have found resolutions for similar errors. If the error isn’t resolved in 24 hours, please reach out to Coursera through our Help Center.”

But by submitting the assignment yet again it managed to actually pass.

so you cleared your assignment?

Yes, now it all got through. Thanks for the support.

1 Like