class documentation

class DequeCDF(_collections.deque):

View In Hierarchy

a queue with (in case) element-wise cdf computation.

The deque is here used like a list with maximum length functionality, the (inherited) constructor takes maxlen as keyword argument (since Python 2.6).

>>> import cma
>>> d = cma.constraints_handler.DequeCDF(maxlen=22)
>>> for i in range(5):
...     d.append([i])
>>> ' '.join(['{:.2}'.format(x) for x in
...                   [d.cdf(0, 0), d.cdf(0, 2), d.cdf(0, 2.1), d.cdf(0, 22.1), d.cdf(0, 4, 2)]])
'0.1 0.5 0.6 1.0 0.75'
Method cdf return ecdf(val) from the i-th element of the last len_ values in self,
Method cdf1 return ECDF at val in case this is a deque of scalars
def cdf(self, i, val=0, len_=None):

return ecdf(val) from the i-th element of the last len_ values in self,

in other words, the ratio of values in self[-len_:][i] to be smaller than val.

def cdf1(self, val=0, len_=None):

return ECDF at val in case this is a deque of scalars