

def hash_vector(self, v, querying=False):
    '\n        Hashes the vector and returns the binary bucket key as string.\n        '
    if scipy.sparse.issparse(v):
        if (self.components_csr == None):
            self.components_csr = scipy.sparse.csr_matrix(self.components)
        if (not scipy.sparse.isspmatrix_csr(v)):
            v = scipy.sparse.csr_matrix(v)
        projection = self.components_csr.dot(v).toarray()
    else:
        projection = numpy.dot(self.components, v)
    return [''.join([('1' if (x > 0.0) else '0') for x in projection])]

dataset/ETHPy150Open pixelogik/NearPy/nearpy/hashes/pcabinaryprojections.py PCABinaryProjections.hash_vector/original