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