Skip to content

Commit

Permalink
acquisition function wrapper
Browse files Browse the repository at this point in the history
Summary: Add a wrapper for modifying inputs/outputs. This is useful for not only probabilistic reparameterization, but will also simplify other integrated AFs (e.g. MCMC) as well as fixed feature AFs and things like prior-guided AFs

Differential Revision: D41629186

fbshipit-source-id: 481783b4db798882da8a53a44a8c2d555d95e30f
  • Loading branch information
sdaulton authored and facebook-github-bot committed Nov 30, 2022
1 parent 55b62bb commit a58079b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions botorch/acquisition/wrapper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

r"""
A wrapper classes around AcquisitionFunctions to modify inputs and outputs.
"""

from __future__ import annotations

from botorch.acquisition.acquisition import AcquisitionFunction
from torch.nn import Module


class AcquisitionFunctionWrapper(AcquisitionFunction):
r"""Abstract acquisition wrapper."""

def __init__(self, acq_function: AcquisitionFunction) -> None:
Module.__init__(self)
self.__class__ = type(
acq_function.__class__.__name__,
(self.__class__, acq_function.__class__),
{},
)
self.__dict__ = acq_function.__dict__
self.acq_function = acq_function

0 comments on commit a58079b

Please sign in to comment.