Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Splitting training and test data using sklearn

#Let us now split the dataset into train & test
from sklearn.model_selection import train_test_split
x_train,x_test, y_train, y_test = train_test_split(X, y, test_size = 0.30, random_state=0)
print("x_train ",x_train.shape)
print("x_test ",x_test.shape)
print("y_train ",y_train.shape)
print("y_test ",y_test.shape)
Source by colab.research.google.com #
 
PREVIOUS NEXT
Tagged: #Splitting #training #test #data #sklearn
ADD COMMENT
Topic
Name
3+2 =