What does test_size = 20 mean?

Asked

Viewed 136 times

-2

I have the following line of code:

X_train,X_test,y_train,y_test = train_test_split(X,Y, test_size = 20, random_state = 0)

What does test_size = 20?

  • which library is using?

  • Guilherme Nascimento is right, I made a mistake and forgot to indicate the library. Yes, it’s Sklearn.model_selection - train_test_split. Thanks for all the answers.

2 answers

2


I believe this API is about https://scikit-learn.org/

So this using the function https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html

The description quotes:

test_size: float, int or None, optional (default=None)

If float, should be between 0.0 and 1.0 and represent the proportion of the dataset to include in the test split. If int, represents the Absolute number of test samples. If None, the value is set to the Complement of the Train size. If train_size is also None, it will be set to 0.25.

Translation:

If it is float, must be between 0.0 and 1.0 and represent the ratio of the data set (dataset) to be included in the test division (probably as a percentage).

If it is int, represents the absolute number of test samples (or exact number and not in percentage).

If None, the value is defined as the complement of the size of the train_size.

If train_size is also None, test_size will be defined as 0.25 (follows the rule of float, proportional).

  • 1

    Why downvote? I said something wrong or I translated wrong what is in OWN documentation?

  • 1

    I didn’t see anything that would justify a negative.

1

As defined, the value 20 and the value 0 represent standard values, that is, if the function train_test_split is called without values for attributes test_size, random_state then these values will be assigned respectively.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.