text_html_output_1.png
import numpy as np

import pandas as pd

import pandas as pd
data = pd.read_csv('/kaggle/input/docs-for-lsh/docs_for_lsh.csv')

import numpy as np
data = data.values[:, 1:]
np.random.seed(0)
n = 30
m = data.shape[0]
length = data.shape[1]
signMatrix = np.zeros((n, m))

def bucketAllocate(r, b):
    Bucket = {}
    for i in range(b):
        tmp = signMatrix[b:b + r]
        for j in range(m):
            signBand = list(tmp[:, j])
            signBand.append(b)
            hashValue = hash(str(signBand))
            if hashValue not in Bucket:
                Bucket[hashValue] = [j]
            else:
                Bucket[hashValue].append(j)
    return Bucket

r = 30
b = 1
bucket = bucketAllocate(r, b)
print(len(bucket))