X_train, X_test, y_train, y_test = train_test_split (X, y, test_size=0.20, random_state=0)
In above code, random_state is used 0. Why we are not using 1?
X_train, X_test, y_train, y_test = train_test_split (X, y, test_size=0.20, random_state=0)
In above code, random_state is used 0. Why we are not using 1?
Neither 0 or 1 for random_state
have any meaning, this parameter controls the seed used by the random number generator, so setting to any value will mean that the split is random, but it will be exactly the same result for each call.
This is generally used for reproducibility, but generally you should't rely on the random_state
to be a particular value.
If you set random_state
to None it will always have a different random behavior each time you call train_test_split
.