This file contains hidden or 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
from dataclasses import dataclass | |
import numpy as np | |
def bayesian_update(x: np.ndarray, | |
k: int, mu: float, alpha: float, beta: float): | |
""" | |
Graphical model is like this: | |
tau ~ IGa(alpha, beta) | |
x_i ~ N(mu, tau) |
This file contains hidden or 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
{ | |
"$type": "garage.experiment.local_runner.LocalRunner", | |
"_algo": { | |
"$type": "garage.torch.algos.pearl.PEARL", | |
"_batch_size": 256, | |
"_context_replay_buffers": { | |
"0": { | |
"$type": "garage.replay_buffer.path_buffer.PathBuffer", | |
"_buffer": {}, | |
"_capacity": 1000000, |
This file contains hidden or 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
class PickledCall: | |
def __new__(cls, to_call, args=(), kwargs=None, __pickle_target=None): | |
if __pickle_target is None: | |
result = super(cls, PickledCall).__new__(cls) | |
result.to_call = to_call | |
result.args = args | |
result.kwargs = kwargs or {} | |
return result | |
else: | |
return __pickle_target(*args, **kwargs) |
This file contains hidden or 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
#!/usr/bin/env python3 | |
import copy | |
import types | |
def configure_with(config_type): | |
''' | |
Attach a configuration type to the provided type. | |
This will allow calling instances of the configuration type to construct | |
instances of the provided type, by copying fields from the configuration | |
object. |