Home python Why do you need train_test_split in Sklearn?

Why do you need train_test_split in Sklearn?




Now I am engaged in machine learning, can someone tell me in detail why I need x_train, x_test, y_train, y_test, the arguments that we get as a result of the TRAIN_TEST_SPLIT function?

x_train, x_test, y_train, y_test = train_test_split (x, y, test_size = 0.2, Random_state = 42)

and how is the Test_Size parameter set?

Answer 1, Authority 100%

So you divide your sample to the training and test part. Training will be happening at the training selection, and on the test – checking the “knowledge” received. Test_Size is used to split the sample (in your case will be 20% used on tests).

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions