0
random_state parameter in machine learning
what is the difference when i set the random_state of an estimator vs setting the random state of any one of model_selection. assume that the value is constant in this case. Example: kf = KFold(..., random_state=12) model = DecisionTreeClassifier(random_state=12) OR xtrain, xtest, ytrain, ytest = train_test_split(..., random_state=12) model = LinearRegression(..., random_state=12)
1 ответ
0
Usually, these functions require the usage of randomness for initialization of data or other processes. When the random_state is not set, then it is randomly chosen on execution. This doesn't allow for replicability, since everytime you execute the code it would use another random_state.
Manually setting a random state allows you to replicate a result, which is useful for debugging. There's really no other advantage to it.