Kruskal's stress

def stress(ref_cds, est_cds):
    """
    Kruskal's stress
    """
    ref_dists = pdist(ref_cds)
    est_dists = pdist(est_cds)
    return np.sqrt(((ref_dists - est_dists)**2).sum() / (ref_dists**2).sum())