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)

15th Oct 2020, 7:04 AM
Faisal Sarfaraz
Faisal Sarfaraz - avatar
1 Antwort
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.
30th Oct 2020, 5:19 AM
Alejandro Aristizabal
Alejandro Aristizabal - avatar