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: cef679d1519c2d2ef5d9fb759c992827e87f2796
  • Loading branch information
sdaulton authored and facebook-github-bot committed Feb 4, 2023
1 parent 2729eba commit 1d2ad1f
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 1d2ad1f

Please sign in to comment.