datasketch/hyperloglog.py
def count(self):
        '''
        Estimate the cardinality of the data values seen so far.

        Returns:
            int: The estimated cardinality.
        '''
        # Use HyperLogLog estimation function
        e = self.alpha * float(self.m ** 2) / np.sum(2.0**(-self.reg))
        # Small range correction
        if e <= (5.0 / 2.0) * self.m:
            num_zero = self.m - np.count_nonzero(self.reg)
            return self._linearcounting(num_zero)
        # Normal range, no correction
        if e <= (1.0 / 30.0) * (1 << 32):
            return e
        # Large range correction
        return self._largerange_correction(e)
def count(self):
        '''
        Estimate the cardinality of the data values seen so far.

        Returns:
            int: The estimated cardinality.
        '''
        # Use HyperLogLog estimation function
        e = self.alpha * float(self.m ** 2) / np.sum(2.0**(-self.reg))
        # Small range correction
        if e <= (5.0 / 2.0) * self.m:
            num_zero = self.m - np.count_nonzero(self.reg)
            return self._linearcounting(num_zero)
        # Normal range, no correction
        if e <= (1.0 / 30.0) * (1 << 32):
            return e
        # Large range correction
        return self._largerange_correction(e)
Estimate the cardinality of the data values seen so far.

        Returns:
            int: The estimated cardinality.