sklearn的train_test_split中的random_state参数 [英] random_state parameter in sklearn's train_test_split
问题描述
随机状态的不同值对输出有何影响?例如,如果我将0设置为100,将对输出产生什么影响?
What difference does different values of random state makes to the output? For instance, if I set 0 and if I set 100 what difference would it make to the output?
推荐答案
从文档:
random_state
是随机数生成器使用的种子。
The
random_state
is the seed used by the random number generator.
通常,使用种子来创建可复制的输出。对于 train_test_split
, random_state
决定如何拆分数据集。
除非要创建可重复运行,否则可以跳过此参数。
In general a seed is used to create reproducible outputs. In the case of train_test_split
the random_state
determines how your data set is split.
Unless you want to create reproducible runs, you can skip this parameter.
例如,如果设置为0,而如果我设置为100,则
对输出有何影响?
For instance, if is set 0 and if i set 100 what difference would it make to the output ?
对于特定种子,您将始终获得相同的训练/测试成绩。不同的种子将导致不同的训练/测试拆分。
You will always get the same train/test split for a specific seed. Different seeds will result in a different train/test split.
这篇关于sklearn的train_test_split中的random_state参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!