Skip to main content



classdistances(Vector of Number x,Function disfn,Bag of (Object,
Vector of Number))->Bag of (Number,Object)

Given a distance function disfn(x,y) calculate all distances from point x to the points in set of points cp

distance(Vector of Number x,Function disfn,Vector of Number y)->Number

Compute the distance between x and y using the distance function disfn(x,y)

knn(Vector of Number,Integer k,Function fn)->Bag

k_nearest(Vector of Number x,Integer k,Function disfn,Bag of (Object,
Vector of Number))->Bag of (Object,Object)

Find k nearest neighbours of point x among points in cp using distance function disfn.

k_nearest_with_fn(Vector of Number x,Integer k,Function disfn,Function fn)
->Bag of (Object,Object)