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

Viewed 2091

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)
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)

Related