FLAML
FLAML copied to clipboard
name 'shuffle' is not defined
Got the error "name 'shuffle' is not defined" when running autoML.
The version of FLAML used is 2.1.2.
Thank you.
Could you provide the entire error if possible? or the code to replicate?
@Programmer-RD-AI My error message:
File "/xxx/python3.8/site-packages/flaml/automl/task/generic_task.py" , line 425, in prepare_data
X_train_all, y_train_all = shuffle(X_train_all, y_train_all, random_state=RANDOM_SEED)
NameError: name 'shuffle' is not defined
I think it may need import random and use random.shuffle
Hi, I will put up a PR for this issue ASAP
@flippercy Looks like your scikit-learn is not working as expected. What do you see with below code:
from sklearn.model_selection import (
GroupKFold,
GroupShuffleSplit,
RepeatedKFold,
RepeatedStratifiedKFold,
StratifiedGroupKFold,
TimeSeriesSplit,
train_test_split,
)
from sklearn.utils import shuffle
@thinkall
Thanks for your hint. Error occurs when import StratifiedGroupKFold.
According to the change log of scikit-learn, model_selection.StratifiedGroupKFold is added in version 1.0, while the minimum version required by FLAML's setup.py is 0.24.
After update scikit-learn to version 1.0, the error disappears.
And sorry for misleading @Programmer-RD-AI , I will check the reason for abnormal behaviors more carefully next time.
@thinkall Thanks for your hint. Error occurs when import
StratifiedGroupKFold.According to the change log of
scikit-learn,model_selection.StratifiedGroupKFoldis added in version 1.0, while the minimum version required by FLAML'ssetup.pyis 0.24. After updatescikit-learnto version 1.0, the error disappears.And sorry for misleading @Programmer-RD-AI , I will check the reason for abnormal behaviors more carefully next time.
Thank you @ao-zz for your feedback, looks like it's time to update the dependencies. I'm working on adding support to python 3.11, will update the dependencies accordingly.
Fixed in #1326