BayesianOptimization icon indicating copy to clipboard operation
BayesianOptimization copied to clipboard

Formatting issues in Windows

Open LucaCerina opened this issue 5 years ago • 5 comments

Hello, when executed in Windows, the optimization have some weird formatting errors. Like this:

| iter | target | bits | size |

| [0m 1 [0m | [0m 1.0 [0m | [0m 21.34 [0m | [0m 1.476e+0[0m | | [0m 2 [0m | [0m 1.0 [0m | [0m 8.004 [0m | [0m 620.6 [0m | | [0m 3 [0m | [0m 1.0 [0m | [0m 12.7 [0m | [0m 190.9 [0m | | [0m 4 [0m | [0m 1.0 [0m | [0m 13.96 [0m | [0m 709.0 [0m | | [0m 5 [0m | [0m 1.0 [0m | [0m 20.7 [0m | [0m 1.104e+0[0m | | [0m 6 [0m | [0m 1.0 [0m | [0m 21.41 [0m | [0m 1.404e+0[0m | | [0m 7 [0m | [0m 1.0 [0m | [0m 14.54 [0m | [0m 1.799e+0[0m | | [0m 8 [0m | [0m 1.0 [0m | [0m 8.876 [0m | [0m 1.374e+0[0m | | [0m 9 [0m | [0m 1.0 [0m | [0m 21.35 [0m | [0m 1.145e+0[0m | | [0m 10 [0m | [0m 1.0 [0m | [0m 12.49 [0m | [0m 407.3 [0m |

LucaCerina avatar Feb 21 '20 12:02 LucaCerina

I have the same issue

moh-na avatar Mar 04 '20 18:03 moh-na

Oh, I believe the way colours are implemented is not compatible with Windows.

Unfortunately I don't have the bandwidth to fix this currently (nor do I have a way of testing it), so PRs are more than welcome.

fmfn avatar May 01 '20 15:05 fmfn

@fmfn I heard about a python module called colorama that may help fixing this issue. https://pypi.org/project/colorama/ I haven't personally tried it out yet but it seems promising.

moh-na avatar May 02 '20 01:05 moh-na

Yep, colorama will definitely do the trick, and it shouldn't be too much work either. Still, I don't plan on tackling this anytime soon.

fmfn avatar May 02 '20 22:05 fmfn

Hi, did someone succeed in solving this issue? I'm currently having similar problems

m-zanichelli avatar Jun 07 '22 07:06 m-zanichelli

Hi, I just checked in windows with the following code snippet which logs correctly to the screen, so as far as I can tell this is resolved. However, if anyone can post some code that reproduces the issues I will reopen.

from bayes_opt import BayesianOptimization

def black_box_function(x, y):
    """Function with unknown internals we wish to maximize.

    This is just serving as an example, for all intents and
    purposes think of the internals of this function, i.e.: the process
    which generates its output values, as unknown.
    """
    return -x ** 2 - (y - 1) ** 2 + 1

# Bounded region of parameter space
pbounds = {'x': (2, 4), 'y': (-3, 3)}

optimizer = BayesianOptimization(
    f=black_box_function,
    pbounds=pbounds,
    random_state=1,
)

optimizer.maximize(
    init_points=2,
    n_iter=3,
)

produces:

Capture

bwheelz36 avatar Oct 30 '22 23:10 bwheelz36

Looks like the problem persists when using powershell, see the recent comment in #257.

till-m avatar Nov 25 '22 14:11 till-m

@windowshopr could you install from my feature branch by running

pip install -U git+https://github.com/till-m/BayesianOptimization@colorama

and then let me know if the issue persists?

till-m avatar Nov 28 '22 10:11 till-m

@till-m

Looks like that fixed it for powershell on my machine!

image

windowshopr avatar Nov 28 '22 23:11 windowshopr