-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?
-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?
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
orNone
,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).
Why downvote? I said something wrong or I translated wrong what is in OWN documentation?
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 python
You are not signed in. Login or sign up in order to post.
which library is using?
– Elton Nunes
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.
– catsandc