Optimal.Similarity function

Optimal scale parameter to transform a distance matrix into a similarity matrix