class_docstr: Projects a vector on n random hyperplane normals and assigns
  a binary value to each projection depending on the sign. This
  divides the data set by each hyperplane and generates a binary
  hash value in string form, which is being used as a bucket key
  for storage.
  
  Almost same as RandomBinaryProjections. Difference is that
  this hash constructs a binary tree in order to guarantee to
  always be able to retrieve N results. Use minimum_result_size
  to set this N.
class_docstr_tok: ["Projects","a","vector","on","n","random","hyperplane","normals","and","assigns","a","binary","value","to","each","projection","depending","on","the","sign",".","This","divides","the","data","set","by","each","hyperplane","and","generates","a","binary","hash","value","in","string","form",",","which","is","being","used","as","a","bucket","key","for","storage",".","Almost","same","as","RandomBinaryProjections",".","Difference","is","that","this","hash","constructs","a","binary","tree","in","order","to","guarantee","to","always","be","able","to","retrieve","N","results",".","Use","minimum_result_size","to","set","this","N","."]
docstr: Hashes the vector and returns the binary bucket key as string.
docstr_tok: ["Hashes","the","vector","and","returns","the","binary","bucket","key","as","string","."]
code: def hash_vector(self, v, querying=False):
      """
      Hashes the vector and returns the binary bucket key as string.
      """
      if scipy.sparse.issparse(v):
          # If vector is sparse, make sure we have the CSR representation
          # of the projection matrix
          if self.normals_csr == None:
              self.normals_csr = scipy.sparse.csr_matrix(self.normals)
          # Make sure that we are using CSR format for multiplication
          if not scipy.sparse.isspmatrix_csr(v):
              v = scipy.sparse.csr_matrix(v)
          # Project vector onto all hyperplane normals
          projection = self.normals_csr.dot(v)
      else:
          # Project vector onto all hyperplane normals
          projection = numpy.dot(self.normals, v)
  
      # Build binary key
      binary_key = "".join(
          ["1" if x > 0.0 else "0" for x in projection]
      )
  
      if querying:
          # print 'Querying...'
          # Make sure returned buckets keys contain at least N results
          return (
              self.tree_root.bucket_keys_to_guarantee_result_set_size(
                  binary_key, self.minimum_result_size, 0
              )
          )
      else:
          # We are indexing, so adapt bucket key counter in binary tree
          self.tree_root.insert_entry_for_bucket(binary_key, 0)
  
          # Return binary key
          return [binary_key]
  
file_path: NearPy/nearpy/hashes/randombinaryprojectiontree.py
imports: import numpy
  import scipy
  import scipy.sparse
  from nearpy.hashes.lshash import LSHash
label_desc: Use image node_id 3 for calling the RandomBinaryProjectionTree obj's underlying member method code with example usage: obj.hash_vector(v, querying) and returns: self, list