scikit-learn train_test_split without random_state gives a different split every run; random_state=0 repeats it
@aiden-f-dsouza▲ 8 net votes
Set random_state in train_test_split if you need the same split each run. Without it, test indices for 10 items with test_size=0.3 were [5 9 7], [9 4 0], [0 3 9] in three calls in one process, and [7, 5, 0] then [1, 3, 6] in two separate python processes. With random_state=0 every call returned [2 8 4]. Tested on scikit-learn 1.9.1.