def soft_associate(vectors, centroids, alpha=.5):
    # Get dists and dist to closest centroid
    #dists = np.sqrt(square_distances(vectors, centroids))
    dists = square_distances(vectors, centroids)
    min_dist = np.expand_dims(np.min(dists, axis=1), 1)
    # Compute weights
    weights = np.exp(-alpha * dists / (EPSILON + min_dist))
    # Normalize weights to sum to 1
    sums = np.sum(weights, axis=1)
    return weights / np.expand_dims(sums, 1)
Returns a matrix (n, k) of association wights, defined as:
dataset/ETHPy150Open omangin/multimodal/multimodal/lib/vector_quantization.py/soft_associate