-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f26499
commit 8ac4ca6
Showing
3 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from __future__ import annotations | ||
|
||
import numpy as np | ||
|
||
from poli.core.black_box_information import BlackBoxInformation | ||
from poli.core.util.abstract_observer import AbstractObserver | ||
|
||
|
||
class MultiObserver(AbstractObserver): | ||
def __init__(self, observers: list[AbstractObserver]): | ||
self.observers = observers | ||
|
||
def observe(self, x: np.ndarray, y: np.ndarray, context=None) -> None: | ||
for observer in self.observers: | ||
observer.observe(x, y, context) | ||
|
||
def initialize_observer( | ||
self, | ||
problem_setup_info: BlackBoxInformation, | ||
caller_info: object, | ||
x0: np.ndarray, | ||
y0: np.ndarray, | ||
seed: int, | ||
) -> object: | ||
for observer in self.observers: | ||
observer.initialize_observer(problem_setup_info, caller_info, x0, y0, seed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters