Skip to content

Values outside pbounds #443

@vanessastadAIT

Description

@vanessastadAIT

Describe the bug
The optimizer tries values that are outside my pbounds. In particular, it happens for the pitch variable. It happens few iterations. I check the definition of pbounds but it seems correct to me .

To Reproduce
A concise, self-contained code snippet that reproduces the bug you would like to report.

from bayes_opt import SequentialDomainReductionTransformer
from bayes_opt import BayesianOptimization
from bayes_opt.util import UtilityFunction
from bayes_opt import BayesianOptimization

pbounds = {'y': (y_limits[0], y_limits[1]), 'yaw': (0, math.pi/2), 'pitch': (pitch_limits[0], pitch_limits[1])}  
  

 f_sensor_bayesian = partial(f_sensor_b, a_old_i=a_old_i, a_c_old_i=a_c_old_i,
                                origin_to_zivid=origin_to_zivid, width_c=width_c, height_c=height_c, width_p=width_p,
                                height_p=height_p,
                                scene=scene, T=T, K_c=K_c, K_p=K_p, r_max=r_max, r_min=r_min, mesh_tri=mesh_tri,
                                grazing_angle_c=grazing_angle_c, grazing_angle_p=grazing_angle_p, x_limits=x_limits,
                                z_limits=z_limits,
                                roll_limits=roll_limits, tilt_angle=tilt_angle,
                                constrained_visibility_bool=constrained_visibility_bool, epsilon=epsilon,
                                resolution=resolution, baseline_p=baseline_p)


    #bounds_transformer = SequentialDomainReductionTransformer(minimum_window=0.5)
    optimizer = BayesianOptimization(
        f=f_sensor_bayesian,
        pbounds=pbounds,
        verbose=1,  # verbose = 1 prints only when a maximum is observed, verbose = 0 is silent
        random_state=10,
        #bounds_transformer=bounds_transformer
    )
 
    optimizer.probe(
    params={"y": position[1], "yaw": orientation[0], "pitch": orientation[1]},
    lazy=True,
    )
    # Set the Gaussian process parameters using the set_gp_params method
    optimizer.set_gp_params(alpha=bayesian_opt['alpha'], n_restarts_optimizer=bayesian_opt['n_restarts_optimizer']) 

    # Create an instance of the UtilityFunction class
    utility = UtilityFunction(kind=bayesian_opt['kind'], kappa=bayesian_opt['kappa'], kappa_decay=bayesian_opt['kappa_decay'], xi=0.1) 


    optimizer.maximize(
        init_points=bayesian_opt['init_points'],
        n_iter=bayesian_opt['n_iter'],
        acquisition_function=utility,
    )  


# The function f_sensor_b is defined with the following inputs
def f_sensor_b(y, yaw, pitch, a_old_i, a_c_old_i, origin_to_zivid, width_c, height_c, width_p, height_p,
               scene, T, K_c, K_p, r_max, r_min, mesh_tri, grazing_angle_c,
               grazing_angle_p, x_limits, z_limits, roll_limits, tilt_angle, baseline_p,
               constrained_visibility_bool, epsilon, resolution)

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