should I keep random state = 0 or 1 in random forest regressor code example
Example: regression best random_state
def maxr2_score(model,x,y):
max_r_score=0
for r_state in range(42,101):
x_train,x_test,y_train,y_test=train_test_split(x,y,random_state=r_state)
model.fit(x_train,y_train)
pred=model.predict(x_test)
score=r2_score(y_test,pred)
if score>max_r_score:
max_r_score=score
final_r_state=r_state
print('max_r2_score is at random_state ',final_r_state,' which is ',max_r_score)
return final_r_state