Get startedGet started for free

Train/Test split

To avoid overfitting, it's common practice in Machine Learning to split data into train and test datasets. This is done to ensure that the model is able to correctly predict new, unseen data.

Since we're working with time-series data, we cannot use random split methods, as that would allow the model to know the future.

A function to print the start and end of a DataFrame is available as show_start_end(), which takes a DataFrame as the only argument, and returns a string.

The data is available as environment.

This exercise is part of the course

Analyzing IoT Data in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Define the split day
limit_day = ____

# Split the data
train_env = ____[____]
test_env = ____[____]
Edit and Run Code