Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I best make %80 train, %10 validation, and %10 percent test splits using train_test_split in Python? [duplicate]

How do I best make %80 train, %10 validation, and %10 percent test splits using train_test_split in Python? Is there a common way to visualize this split once created?

from sklearn.model_selection import train_test_split

# Splitting the data by a percentage
train_data, test_data = train_test_split(mid_prices, train_size=0.8, test_size=0.2, shuffle=False)
like image 459
iceAtNight7 Avatar asked Oct 16 '25 12:10

iceAtNight7


1 Answers

Initially divide the data into 80% and 20%. 80% for training and remaining 20% for test and validation.

train_data, rest_data = train_test_split(mid_prices, train_size=0.8, shuffle=False)

Now you can split the remaining data into 50% each to have 10% validation and 10% test.

validation_data, test_data = train_test_split(rest_data, test_size=0.5, shuffle=False)

like image 66
Yogesh Bhandari Avatar answered Oct 19 '25 01:10

Yogesh Bhandari