You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
The idea behindKeyedVector is that getting rid of dictionary. You don't need a dictionary, because the indices could beString or any other thing that you want. Although it could beInt and you can use it with some dictionary.Anyway,KeyedVector has a close relation withHashMap. EveryKeyedVector has an ID, and this is the most important difference:
valvector=newKeyedVector(id, map)
and withvector.id orvector.toMap you can get either one of them. You can also dovector.get(key) orvector.keySet.
The other class implemented here isKeyedVectors, that provides some tools forKeyedVectors:
vali1=KeyedVectors.dot(v1, v2)vali2=KeyedVectors.normInfinity(v1)vali3=KeyedVectors.normNN(v1, n)// Minkowski norm ^n, which is squared Euclidean norm for n=2vali4=KeyedVectors.distNN(v1, v2, n)// distance function induces from normvali5=KeyedVectors.norm(v1)// Euclidean normvali6=KeyedVectors.eucDist(v1, v2)vali7=KeyedVectors.sqEucDist(v1, v2)// squared Euclidean distancevali8=KeyedVectors.cosineSim(v1, v2)vali9=KeyedVectors.cosineDist(v1, v2)
Canopy Clustering Algorithm
Canopy algorithm on pure scala. There are two implementations for canopy algorithm. First, the simple implementation with O(n^2), and the other, the merged implementation with O(n^{3/2}) running time.