def weighted_matrix(
    point: np.array, training_data_x: np.array, bandwidth: float
) -> np.array:
    m, _ = np.shape(training_data_x)  # m is the number of training samples
    weights = np.eye(m)  # Initializing weights as identity matrix

    # calculating weights for all training examples [x(i)'s]
    for j in range(m):
        diff = point - training_data_x[j]
        weights[j, j] = np.exp(diff @ diff.T / (-2.0 * bandwidth**2))
    return weights