Implementing Flajolet and Martin’s Algorithm in python -


The following is the code I have written to apply. I use the Jenkins hash function The code has to be used for the 32-bit hash value program sounds algorithm, but close to 20% the mark is closed. My data set has more than 200,000 unique records, while the program has approximately 160,000 unique records. Please help me understand the mistakes I have been making. The hash function has been implemented accordingly.

import from nppy as imported jhash class PCSA (): def __init __ (self, nmap, maxlength): self.nmap = nmap self.maxlength = maxlength self.bitmap = Np.zeros ((nmap, maxlength), dtype = np.int) DEF count (self, data): hashedValue = jhash (data) indexAlpha = hashedValue% self.nmap ix = hashedValue / self.nmap ix = bin (ix) See the index of [2:] [:: - 1] index beta = ix.find ("1") #lsb if self.bitmap [indexAlpha, indexBeta] == 0: self.bitmap [indexAlpha, indexBeta] = 1 def GetCardinality (self): sumIx = 0 (self.nmap) for the row in the range: sumIx + = np.where (self.bitmap [row,] == 0) [0] [0] a = sumIx / self.nmap Prompt = self.nmap * (2 ** A) / MAGIC_CONST return Text after the head

If you are running it in Python 2, then calculate the partition For one one may be in being changed for an integer

If this is the case, then you can try to change:.

  A = float (sumIx) / self.nmap  
  a = sumIx / self .nmap  

/ Code>


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -