Skip to content

InputDataError in botorch_bo #3

Description

@michael-boese

Botorch_bo algorithm returns InputDataError when running it with Silly environment.

  File "/Users/xfeloper/.conda/envs/badger/lib/python3.9/site-packages/badger/gui_acr/components/routine_runner.py", line 51, in run
    run_routine(self.routine, True, self.save, self.verbose,
  File "/Users/xfeloper/.conda/envs/badger/lib/python3.9/site-packages/badger/core.py", line 333, in run_routine
    raise e
  File "/Users/xfeloper/.conda/envs/badger/lib/python3.9/site-packages/badger/core.py", line 330, in run_routine
    optimize(evaluate, configs)
  File "/Users/xfeloper/user/boese/badger/Badger-Plugins/algorithms/botorch_bo/__init__.py", line 34, in optimize
    x_new, _ = get_BO_point(train_X, train_Y, bounds, beta=beta)
  File "/Users/xfeloper/user/boese/badger/Badger-Plugins/algorithms/botorch_bo/__init__.py", line 68, in get_BO_point
    gp = botorch.models.SingleTaskGP(x, f)  # , precision)
  File "/Users/xfeloper/.conda/envs/badger/lib/python3.9/site-packages/botorch/models/gp_regression.py", line 122, in __init__
    self._validate_tensor_args(X=transformed_X, Y=train_Y)
  File "/Users/xfeloper/.conda/envs/badger/lib/python3.9/site-packages/botorch/models/gpytorch.py", line 106, in _validate_tensor_args
    raise InputDataError(
botorch.exceptions.errors.InputDataError: Expected all inputs to share the same dtype. Got torch.float32 for X, torch.float64 for Y, and None for Yvar.

Casting the values into float solves the problem but returns following warning:

/Users/xfeloper/.conda/envs/badger/lib/python3.9/site-packages/botorch/models/gpytorch.py:113: UserWarning: The model inputs are of type torch.float32. It is strongly recommended to use double precision in BoTorch, as this improves both precision and stability and can help avoid numerical errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions