WalkerProperty: Changed weighted_average() to average().
@@ -34,14 +34,14 @@ class Property:
setattr(owner, self.name, self)
self.__set_name__(owner, self.name)
- @property
- def name(self):
- return self.fget.__name__
-
@property
def __doc__(self):
return self.fget.__doc__
+ @property
+ def name(self):
+ return self.fget.__name__
+
@property
def private_name(self):
return '_' + self.name
@@ -88,7 +88,20 @@ class WalkerProperty(Property):
def __init__(self, fget, *, cache=False):
super().__init__(fget, owner=Walker, cache=cache)
- def weighted_average(self, iterations):
+ def average(self, iterations):
+ """Compute the weighted average over a given set of iterations.
+
+ Parameters
+ ----------
+ iterations : Iterable[Iteration]
+ The iterations over which to compute the average.
+
+ Returns
+ -------
+ array_like
+ The weighted average of the walker property over `iterations`.
+
+ """
num_iterations = 0
for iteration in iterations:
num_iterations += 1
@@ -99,6 +112,8 @@ class WalkerProperty(Property):
value += np.dot(iteration.weights, values)
return value / num_iterations
+ # TODO(Jeff): Implement blocked averages.
+
def argmax(func, args):
argmax = None
