#Split the training set and the test set x_train, x_test, y_train, y_test = train_test_split What do the parameters mean?

#Split training set and test set

x_train, x_test, y_train, y_test = train_test_split (

    x, y, test_size=0.2, random_state=42)

 

Full template:

train_X,test_X,train_y,test_y = train_test_split(train_data,train_target,test_size=0.3,random_state=5)

Parameter explanation:

train_data: sample data to be divided

train_target: the result of the sample data to be divided (label)

test_size: the proportion of test data in the sample data, if the integer is the number of samples

random_state: Set the random number seed to ensure that it is the same random number every time. If it is 0 or not filled, the data will be different every time

Guess you like

Origin blog.csdn.net/weixin_42859280/article/details/110391992