You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to run the AutoML fit method with custom StratifiedKFold cross-validation, an error occurs in the FLAML library. The error message indicates that the StratifiedKFold.split() method is missing a required positional argument: 'y'.
Code:
fromflamlimportAutoMLfromsklearn.datasetsimportload_breast_cancerfromsklearn.model_selectionimporttrain_test_split, StratifiedKFold# Load the datasetdata=load_breast_cancer()
X=data.datay=data.target# Split the dataset into training and testing setsX_train, X_test, y_train, y_test=train_test_split(
X, y, test_size=0.2, random_state=42
)
# Initialize the AutoML objectautoml=AutoML()
# Define custom cross-validation splitcv=StratifiedKFold(n_splits=5, shuffle=True, random_state=42)
# Define the settings for the AutoML runsettings= {
"time_budget": 60*60*8, # 8 hours"metric": "accuracy",
"task": "classification",
"estimator_list": ["lgbm"], # LightGBM"eval_method": "cv", # Cross-validation"ensemble": True,
"n_splits": 5, # Number of cross-validation splits"split_type": cv, # Custom split type
}
# Run the AutoML fit methodautoml.fit(X_train, y_train, **settings)
When attempting to run the AutoML fit method with custom StratifiedKFold cross-validation, an error occurs in the FLAML library. The error message indicates that the
StratifiedKFold.split()
method is missing a required positional argument: 'y'.Code:
Error Message:
The text was updated successfully, but these errors were encountered: