def estimate(self): """ Estimate the F2 moment of the given stream :return: estimated F2 moment :rtype: int/real """ return utils.median([utils.mean( map(lambda x: x**2, self._sketch[i]) ) for i in xrange(self._mu)])
def estimate(self, key): """ Estimate the frequency of given item. :param key: key/item in the data stream :return: estimated frequency of the given key. :rtype: int/real """ all_estimators = [self._sketch[i][self._hashes[i].hash(key) % self._w] for i in xrange(self._mu)] return utils.median(all_estimators)
def estimate(self): """ Estimate the F2 moment of the given stream :return: estimated F2 moment :rtype: int/real """ return utils.median([ utils.mean(map(lambda x: x**2, self._sketch[i])) for i in xrange(self._mu) ])
def estimate(self, key): """ Estimate the frequency of given item. :param key: key/item in the data stream :return: estimated frequency of the given key. :rtype: int/real """ all_estimators = [(self._sign[i].hash(key) % 2 * 2 - 1) * self._sketch[i][self._hashes[i].hash(key) % self._w] for i in xrange(self._mu)] return utils.median(all_estimators)
def estimate(self): return utils.median([len(self.B)*2**(self.sketch[i]) for i in xrange(self.mu)])
def estimate(self): return utils.median([2**(self.sketch[i]+0.5) for i in xrange(self.mu)])
def getEstimation(self, i): """ return the (eps, delta)-approximation """ return median( [est.getEstimation(i) for est in self.estimators] )
def getEstimation(self): return median([self._mean(arr) for arr in self.estimators])
def getEstimation(self, i): """ return the (eps, delta)-approximation """ return median([est.getEstimation(i) for est in self.estimators])
def estimate(self): return utils.median( [len(self.B) * 2**(self.sketch[i]) for i in xrange(self.mu)])
def estimate(self): return utils.median( [2**(self.sketch[i] + 0.5) for i in xrange(self.mu)])