I'm attempting to create, train, and test sklearn models iteratively:
for min_samples_leaf in [1, 2, 3, 5]:
for min_samples_split in [2, 3, 4, 10]:
for n_estimators in [200, 500, 1000, 1500]:
classifier = RandomForestClassifier(bootstrap=True, min_samples_leaf=min_samples_leaf, min_samples_split=min_samples_split, n_estimators=n_estimators, random_state=6, n_jobs=4)
classifier.fit(X_train, y_train)
print(accuracy_score(y_validate, classifier.predict(X_validate)))
However, the accuracy score is the same every time that classifier
is trained and prints a result against a validation set.
My questions are (1) why is this happening? (2) what is the correct way to take this approach?
Edit: It may be relevant to note that I'm also measuring accuracy in other ways as well as the accuracy score, and the results are truly identical with every iteration.
question from:https://stackoverflow.com/questions/65943860/instantiating-sklearn-models-iteratively