powered by
Calculate the distance between two vectors.
distance(x, y, measure)
Numeric vectors.
Distance measure ("euclidean" or "squared_euclidean").
The distance between x and y.
x
y
Distance measures in this package are based on those defined in the PMML specification. Distances are calculated using the following equations:
Euclidean: \((\sum((x_i - y_i)^2))^0.5\) Squared euclidean: \(\sum((x_i - y_i)^2)\)
The input vectors must be of the same length.
similarity, PMML comparison measures
similarity
# NOT RUN { distance(c(-0.5,1),c(0.4,1.6),"euclidean") distance(c(-0.5,1),c(0.4,1.6),"squared_euclidean") # }
Run the code above in your browser using DataLab