Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I also just realised that I was misunderstood something. You do not need to split the dataset into training and test sets before using the cross_val_score function. Just pass in the features and the target variable and the function automatically creates the sets at each fold.
I believed that the cross-validation method was intended so that a validation set was not necessary, especially if you are working with a small dataset such as the Boston housing dataset that I'm working with.