Skip to content

cannot import name 'acquisition' from 'bayes_opt' #500

Closed

Description

@dinghly

Hello, I am trying to reproduce the section exploitation vs exploration from https://bayesian-optimization.github.io/BayesianOptimization/exploitation_vs_exploration.html#Acquisition-Function-%22Upper-Confidence-Bound%22

I have installed bayesian optimization 1.5.1 and whenever I am trying to import acquisition by typing

from bayes_opt import acquisition,

it returns

ImportError: cannot import name 'acquisition' from 'bayes_opt' (C:\Users\ldhy9\AppData\Local\Programs\Python\Python311\Lib\site-packages\bayes_opt_init_.py)

can you help why?

thank you

Activity

  1. t-muser commented on Jul 16, 2024

    @t-muser
    Member

    Hi @dinghly,

    you're very fast! We merged a PR recently that changed the acquisition function and docs are hosted based on master. However, we haven't pushed the release yet. The notebook for v1.5.1 can be found here. Hope that helps!

  2. dinghly commented on Jul 16, 2024

    @dinghly
    Author

    Thank you so much for your quick help!

  3. evancollins1 commented on Aug 15, 2024

    @evancollins1

    Hi, I'm also having troubles with

    from bayes_opt import acquisition

    To clarify, are "utility" and "acquisition" functions referring to the same thing? Thus, would

    acquisition_function = acquisition.ExpectedImprovement(xi=0.1)
    be equivalent to
    utility_function = UtilityFunction(kind="ei", xi=0.1)
    ???
    (The latter one works and avoids this import issue)

    Thanks

  4. t-muser commented on Aug 15, 2024

    @t-muser
    Member

    Hi @evancollins1,

    In short, the code you describe shows how to do the exact same thing in different versions, so you can consider them conceptually the same.

    To be more specific, the old way acquisition functions were implemented was somewhat inflexible and convoluted. This code has been overhauled and is what you can find on master. However, it's not yet released. As the code documentation online is based on what you can find on master (as of now, I'm working on this, see #509) you're seeing the code for the newer, yet to be released, version while probably using an older one.

    I hope that clears up the confusion. Apologies for any inconveniences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions