Помоги исправить ошибку:
def generate_matrix_and_vector(n, m=32):
    A = np.random.randint(0, 2, size=(n, m), dtype=np.int8)
    b = np.random.randint(0, 2, size=n, dtype=np.int8)
    return A, b

def generate_hash(A, b, x):
    n, m = A.shape
    if m != 32:
        raise ValueError("Matrix A must have 32 columns.")
    if len(b) != n:
        raise ValueError("Vector b must have same number of rows as A.")

    x = int(x)
    x_bits = np.array([(x >> i) & 1 for i in range(32)], dtype=np.int8)
    r = np.zeros(n, dtype=np.int8)
    for i in range(n):
        Ai = A[i]
        parity = np.sum(Ai & x_bits) % 2
        r[i] = parity
    return r ^ b

def generate_data(distribution_name, size):
    if distribution_name == 'uniform':
        return generate_uniform_random_numbers(size)
    elif distribution_name == 'normal':
        return generate_normal_random_numbers(size, mean=500000, std_dev=100000)


    elif distribution_name == 'zipf':
        return generate_zipf_random_numbers(size, N=1000000, s=1.5)

def compute_k_values(hashed_values):
    k_values = []
    for h in hashed_values:
        rev = h[::-1]
        #print(rev)
        indices = np.where(rev == 1)[0]
        #print(indices)
        index = indices[0] if len(indices) > 0 else len(h)
        #print(index)
        k_values.append(index)
    return k_values   

def calculate_statistics(k_values):
    if len(k_values) == 0:
        return None, None, None, None, None

    powers = [2 ** k for k in k_values]
    arithmetic_mean = np.mean(powers)
    geometric_mean = np.exp(np.mean(np.log(powers)))
    harmonic_mean = len(powers) / np.sum(1 / np.array(powers))
    median = np.median(powers)

    return arithmetic_mean, geometric_mean, harmonic_mean, median

n_hashes = 50  # number of hashes
max_n = 16
x = generate_data("uniform", 5000)
arithmetic_means = []
geometric_means = []
harmonic_means = []
medians = []

for _ in range(n_hashes):
    A, b = generate_matrix_and_vector(n=max_n)

    hashed_values = [generate_hash(A, b, x_value) for x_value in x]
    #for i in range(len(x)):
        #print(f"{x[i]} : {hashed_values[i]}")

    k_values = compute_k_values(hashed_values)
    #print(f"k_values = {k_values}")

    ar_mean, geo_mean, harm_mean, med = calculate_statistics(k_values)
    #print(f"ar_mean = {ar_mean}")
    #print(f"geo_mean = {geo_mean}")
    #print(f"harm_mean = {harm_mean}")
    #print(f"med = {med}")

    arithmetic_means.append(ar_mean)
    geometric_means.append(geo_mean)
    harmonic_means.append(harm_mean)
    medians.append(med)

plt.figure(figsize=(14, 12))

plt.subplot(2, 2, 1)
plt.plot(x_values, arithmetic_means, marker='o', color='blue')
plt.title('Arithmetic Mean')
plt.xlabel('Number of hash functions')
plt.ylabel('Estimated size')
plt.grid()

plt.subplot(2, 2, 2)
plt.plot(x_values, geometric_means, marker='o', color='green')
plt.title('Geometric Mean')
plt.xlabel('Number of hash functions')
plt.ylabel('Estimated size')
plt.grid()

plt.subplot(2, 2, 3)
plt.plot(x_values, harmonic_means, marker='o', color='red')
plt.title('Harmonic Mean')
plt.xlabel('Number of hash functions')
plt.ylabel('Estimated size')
plt.grid()

plt.subplot(2, 2, 4)
plt.plot(x_values, medians, marker='o', color='purple')
plt.title('Median')
plt.xlabel('Number of hash functions')
plt.ylabel('Estimated size')
plt.grid()

plt.tight_layout()
plt.show()

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-109-5b9e5a794dea> in <cell line: 0>()
      2 
      3 plt.subplot(2, 2, 1)
----> 4 plt.plot(x_values, arithmetic_means, marker='o', color='blue')
      5 plt.title('Arithmetic Mean')
      6 plt.xlabel('Number of hash functions')

3 frames
/usr/local/lib/python3.11/dist-packages/matplotlib/axes/_base.py in _plot_args(self, axes, tup, kwargs, return_kwargs, ambiguous_fmt_datakey)
    492 
    493         if x.shape[0] != y.shape[0]:
--> 494             raise ValueError(f"x and y must have same first dimension, but "
    495                              f"have shapes {x.shape} and {y.shape}")
    496         if x.ndim > 2 or y.ndim > 2:

ValueError: x and y must have same first dimension, but have shapes (20,) and (50,)