Coder Social home page Coder Social logo

name 'shuffle' is not defined about flaml HOT 7 CLOSED

flippercy avatar flippercy commented on September 23, 2024
name 'shuffle' is not defined

from flaml.

Comments (7)

ao-zz avatar ao-zz commented on September 23, 2024 2

@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.

from flaml.

thinkall avatar thinkall commented on September 23, 2024 1

@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.

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.

from flaml.

Programmer-RD-AI avatar Programmer-RD-AI commented on September 23, 2024

Could you provide the entire error if possible?
or the code to replicate?

from flaml.

ao-zz avatar ao-zz commented on September 23, 2024

@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

from flaml.

Programmer-RD-AI avatar Programmer-RD-AI commented on September 23, 2024

Hi,
I will put up a PR for this issue ASAP

from flaml.

thinkall avatar thinkall commented on September 23, 2024

@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

from flaml.

thinkall avatar thinkall commented on September 23, 2024

Fixed in #1326

from flaml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.