Esempio n. 1
0
    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)])
Esempio n. 2
0
    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)
Esempio n. 3
0
 def estimate(self):
     return utils.median([len(self.B)*2**(self.sketch[i]) for i in xrange(self.mu)])
Esempio n. 4
0
 def estimate(self):
     return utils.median([2**(self.sketch[i]+0.5) for i in xrange(self.mu)])
Esempio n. 5
0
 def getEstimation(self, i):
     """ return the (eps, delta)-approximation """
     return median( [est.getEstimation(i) for est in self.estimators] )
Esempio n. 6
0
 def getEstimation(self):
     return median([self._mean(arr) for arr in self.estimators])