C4W1 Working with Generated Time Series grading problem "time_valid" not defined

Hi everyone,

I’m encountering an issue with the grading of the Sequences, Time Series, and Prediction (TensorFlow Course 4, Week 1) programming assignment: Working with Generated Time Series.

Despite completing the tasks, all my results are being evaluated as 0/10, and I receive the following error:

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

I’ve confirmed that time_valid is defined in the notebook. I’ve tried the following steps to resolve the issue:

  • Updated the notebook and started over
  • Followed the debugging steps from a similar post on the forum

However, the notebook still scores 0 for all tasks. Has anyone else faced this issue, or does anyone have suggestions for how to resolve it?

Thanks in advance for your help!

Please follow these steps to refresh your workspace and try again.
If the problem still persists, please click on my name to start a private message. Then, attach your notebook as a .ipynb file. Please note that mentors cannot access your Coursera Jupyter workspace, so sending the notebook in a .ipynb format is essential.

@Voyager42

Thank you for creating new topic as per mentioned in previous discussion. Other mentor has already responded you, so I suppose your issue is being addressed.

Remember even if you have passed the test, using an incorrect fuction than what metadata is being written will still counts for a grader failure.

Another reasons which I found with most learners were in moving avg forecast were most learners hard-coded the path,or used incorrect time series.

Next common errors were while writing codes for series, most of the learner tend to use len function which is incorrect for diff series rather one needs to define based on split time and correct time assign.

sharing a post comments where codes correction points are mentioned grade cell wise. if you still not able to find then share screenshot of your codes by personal DM only.

Regards
DP

1 Like

In your case, the problem is with this line in exercise 6:

# Perform the correct slicing
diff_moving_avg = ...

Use constants SPLIT_TIME and WINDOW_SIZE for slicing the array.

2 Likes

Thank you for identifying the issue – it’s now resolved!

The problem was with the assignment of the diff_moving_avg variable, which caused the entire grading to fail, including the other 7 functions. For the future, could you please advise how I can identify this kind of issue from the output in the notebooks?

Additionally, I’m curious as to why the diff_moving_avg assignment was wrong when using -len(time_valid) for the diff series. The shapes seemed to match, and it works fine when I use constants. It also runs without any issues on my local Python installation.

I’d appreciate any insights you might have!

Please see #grade-upto-here.

The staff have been asked to rewrite the notebook to use functions instead of magically deciding which variables are valid in the grader.

1 Like