This Assignment is giving me Headache, Please Look into this with me

Added by mentor: C4W1 Assignment, function train_val_split

{removed by mentor}

expected output is correct, what seems to be the problem?

Lets go to Naive Forecast
{removed by mentor}
expected output aligned

here’s the problem

expected output

This is really giving me a headache, I can’t progress to the next stage without resolving this, I have been on this since.

Look what I am getting for train_val_split

naive_forecast, I cant fathom the problem

Hello @Deloni,

I don’t mentor this course, but since it is giving you a headache, I am going to give it a try and share what I saw:


Let’s look at time_step=SPLIT_TIME. It means the function is taking an input argument called time_step, and if the value of time_step is not specified when calling the function, then it is assumed to be SPLIT_TIME. For example, calling train_val_split(something1, something2) without the 3rd argument means to assume it to be SPLIT_TIME.

Here, it is important to note that, time_step is the actual name of the input argument, but NOT SPLIT_TIME. SPLIT_TIME is like the default value for time_step. It means that, if one of those assignment’s test does specify time_step to be something, like time_step = 20, then only if you have used time_step as the variable name inside the function allows the function to actually use the value of 20. You got me? time_step is the variable name to be used in the function, not SPLIT_TIME.

Hope this will solve some of the problems, if not all. If there are other problems, please reply and I hope mentors of this course will help.

Good luck!

PS: I am going to remove some screenshots from your post because it is generally not allowed to share assignment work here.

1 Like

I see my mistake, thank you so much for your correction. using time_step variable and it worked fine perfectly

That’s great!


1 Like