Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

split data into training, testing and validation set python

import numpy as np
from sklearn.model_selection import train_test_split

X, y = np.arange(10).reshape((5, 2)), range(5)

# First: split data into train and test 
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)

# Second: use the train set to get the validation set and the final train set
X_train, X_val, y_train, y_val = train_test_split(X_train, y_train, test_size=0.33, random_state=42)

Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #split #data #testing #validation #set #python
ADD COMMENT
Topic
Name
5+5 =