What does setting random_state in train_test_split guarantee?
Correct answer
B. The same split is produced on repeated runs with the same inputs and library version
15 views
B. The same split is produced on repeated runs with the same inputs and library version
15 views
random_state seeds the internal pseudo-random generator, so with identical data and library version the same permutation and the same train/test rows come back, which makes experiments reproducible. It does not make splits independent, and a different pandas or NumPy version may change the sampling path. For class balance, stratify=y is what preserves proportions.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is B? Ask here and get an explanation.