I’m stuck on C4W1 Assignment of Sequences, Time Series and Prediction
I’m referring to Exercise 1: train_val_split
Complete the train_val_split function below which receives the time (x coordinate) and series (y coordinate) data. Notice that this value defaults to 1100 since this is an appropriate step to split the series into training and validation
Here, x-coordinates are time data and y-coordinates are series data right? But I can’t seem to pass the unit test, when I use them that way. I’m confused about series_train and series_valid. I thought I had to enter series data for these.
Please explain how I can fix this.
Thanks!
1 Like
train_val_split wants you to split series and time arrays into 2 parts based on the SPLIT_TIME global variable. Everything before SPLIT_TIME belongs to the train set. The rest belongs to validation set.
Just like many problems seen so far, it’s typical to have a train set to tune model parameters and the test set to evaluate how well the model generalizes to data unseen during training.
1 Like
Thank you for replying! I understand that we need both a training set and a validation set. My problem is about splitting data. For sereies_train and series_valid, we need to split the SERIES array into train and validation right? That’s how I split the data and yet got this error message. That’s why I got confused. I think I’m misinterpreting something here.
Please look at the function signature: def train_val_split(time, series):
You have to split time and series based on SPLIT_TIME.
Be mindful of using global variables where not necessary. Do read TIPS FOR SUCCESSFUL GRADING OF YOUR ASSIGNMENT: section of the notebook for more hints on completing the assignment successfully.
1 Like
Thank you! I figured it out and it works fine now. 