microsoft / FLAML

A fast library for AutoML and tuning. Join our Discord: https://discord.gg/Cppx2vSPVP.
https://microsoft.github.io/FLAML/
MIT License
3.75k stars 495 forks source link

Fix shuffle not defined #1313

Closed Programmer-RD-AI closed 3 weeks ago

Programmer-RD-AI commented 3 weeks ago

This PR addresses the NameError encountered due to the missing import of the 'shuffle' function in the generic_task.py file.

Changes made:

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

With this fix, the data shuffling step will execute correctly without raising a NameError.

Closes #1308

Why are these changes needed?

This change resolves a NameError that occurs due to the missing import of the shuffle function. By importing shuffle from sklearn.utils, we ensure that the data preparation step involving shuffling executes correctly, preventing runtime errors and improving the stability of the code.

Related issue number

Closes #1308

Checks