Open huangssssir opened 5 months ago
kf = KFold(n_splits=5, shuffle=True, random_state=42)
model = RandomForestClassifier()
for fold, (train_index, test_index) in enumerate(kf.split(X)):
model.fit(X_train, y_train)
With the use of a code snippet similar to the above you can use resolve your issue... Let me know if there is an issue :) Best regards, Ranuga
Hello. I need to obtain the training and test data corresponding to each grouping in cross validation, as well as the corresponding trained model, for subsequent analysis. How can I get this?