FLAML icon indicating copy to clipboard operation
FLAML copied to clipboard

Where can I get the corresponding model for each cross validation

Open huangssssir opened this issue 1 year ago • 1 comments
trafficstars

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?

huangssssir avatar Jan 22 '24 08:01 huangssssir

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

Programmer-RD-AI avatar May 31 '24 01:05 Programmer-RD-AI