Randomly split training set and test set in sklearn

from sklearn.model_selection import train_test_split
X_train,X_test,Y_train,Y_test = train_test_split(X,Y,test_size=0.3,random_state=0)

The random_state here is to ensure that the program is divided into the same training set and test set every time it runs. Otherwise, the same algorithm model has different effects on different training sets and test sets.

Guess you like

Origin blog.csdn.net/banxiaCSDN/article/details/112957133