示例#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)])
示例#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)
示例#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)
        ])
示例#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)
示例#5
0
 def estimate(self):
     return utils.median([len(self.B)*2**(self.sketch[i]) for i in xrange(self.mu)])
示例#6
0
 def estimate(self):
     return utils.median([2**(self.sketch[i]+0.5) for i in xrange(self.mu)])
示例#7
0
 def getEstimation(self, i):
     """ return the (eps, delta)-approximation """
     return median( [est.getEstimation(i) for est in self.estimators] )
示例#8
0
文件: F2.py 项目: grista/StreamLib
 def getEstimation(self):
     return median([self._mean(arr) for arr in self.estimators])
示例#9
0
 def getEstimation(self, i):
     """ return the (eps, delta)-approximation """
     return median([est.getEstimation(i) for est in self.estimators])
示例#10
0
文件: F2.py 项目: grista/StreamLib
 def getEstimation(self):
     return median([self._mean(arr) for arr in self.estimators])
示例#11
0
 def estimate(self):
     return utils.median(
         [len(self.B) * 2**(self.sketch[i]) for i in xrange(self.mu)])
示例#12
0
 def estimate(self):
     return utils.median(
         [2**(self.sketch[i] + 0.5) for i in xrange(self.mu)])