assertion replaced by exception which is more informative
added weights to distance computing
k-means is used by default