sklearn中random_state问题

在sklearn中train_test_split()函数 中random_state这个参数有什么用?我只知道选取不同的值对模型训练有影响。

我发现取不同的random_state用knn算法得到的p值和k值不同,心累

http://scikit-learn.org/stable/modules/generated/sklearn.utils.check_random_state.html

此参数让结果容易复现。 一个确定的随机值将会产生相同的结果,在参数和训练数据不变的情况下

Many machine learning models allow some randomness in model training.
Specifying a number for random_state ensures you get the same results in each run.
This is considered a good practice.
You use any number, and model quality won't depend meaningfully on exactly what value you choose.

https://www.kaggle.com/code/dansbecker/your-first-machine-learning-model