class_docstr: Projects a vector on n first principal components and assigns
  a discrete value to each projection depending on the bin.
class_docstr_tok: ["Projects","a","vector","on","n","first","principal","components","and","assigns","a","discrete","value","to","each","projection","depending","on","the","bin","."]
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.components_csr == None:
              self.components_csr = scipy.sparse.csr_matrix(
                  self.components
              )
          # 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.components_csr.dot(v) / self.bin_width)
              .floor()
              .toarray()
          )
      else:
          # Project vector onto components
          projection = numpy.dot(self.components, v)
          projection = numpy.floor(projection / self.bin_width)
      # Return key
      return ["_".join([str(int(x)) for x in projection])]
  
file_path: NearPy/nearpy/hashes/pcadiscretizedprojections.py
imports: import numpy
  import scipy
  import scipy.sparse
  from nearpy.hashes.lshash import LSHash
  from nearpy.utils import numpy_array_from_list_or_numpy_array, perform_pca
label_desc: Use image node_id 3 for calling the PCADiscretizedProjections obj's underlying member method code with example usage: obj.hash_vector(v, querying) and returns: list