Commit 9a6f726b authored by Philipp Arras's avatar Philipp Arras
Browse files

_eval -> force

parent c0c11710
...@@ -33,10 +33,6 @@ from ..minimization.energy_adapter import StochasticEnergyAdapter ...@@ -33,10 +33,6 @@ from ..minimization.energy_adapter import StochasticEnergyAdapter
from ..utilities import myassert from ..utilities import myassert
def _eval(op, position):
return op(position.extract(op.domain))
class MeanFieldVI: class MeanFieldVI:
def __init__(self, initial_position, hamiltonian, n_samples, mirror_samples, def __init__(self, initial_position, hamiltonian, n_samples, mirror_samples,
initial_sig=1, comm=None, nanisinf=False): initial_sig=1, comm=None, nanisinf=False):
...@@ -64,15 +60,15 @@ class MeanFieldVI: ...@@ -64,15 +60,15 @@ class MeanFieldVI:
@property @property
def mean(self): def mean(self):
return _eval(self._mean,self._KL.position) return self._mean.force(self._KL.position)
@property @property
def std(self): def std(self):
return _eval(self._std,self._KL.position) return self._std.force(self._KL.position)
@property @property
def entropy(self): def entropy(self):
return _eval(self._entropy,self._KL.position) return self._entropy.force(self._KL.position)
def draw_sample(self): def draw_sample(self):
_, op = self._generator.simplify_for_constant_input( _, op = self._generator.simplify_for_constant_input(
...@@ -116,11 +112,11 @@ class FullCovarianceVI: ...@@ -116,11 +112,11 @@ class FullCovarianceVI:
@property @property
def mean(self): def mean(self):
return _eval(self._mean,self._KL.position) return self._mean.force(self._KL.position)
@property @property
def entropy(self): def entropy(self):
return _eval(self._entropy,self._KL.position) return self._entropy.force(self._KL.position)
def draw_sample(self): def draw_sample(self):
_, op = self._generator.simplify_for_constant_input( _, op = self._generator.simplify_for_constant_input(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment