I want to use pdist()
in MATLAB and use a custom function "Extended Jaccard" defined as bellow:
S_EJ(X_a, X_b) = (X_a . X_b) / (||X_a||^2 + ||X_b||^2 - X_a . X_b)
where X_a . X_b
represents the inner product between vectors X_a
and X_b
and || ||^2 is the norm_2 of a given vector.
It is strongly recommended to take advantage of bsxfun()
as it is based on multi-threading. Ofcourse, if this is possible.
What do you think about:
SEJ(x,y) = bsxfun(@(x, y) (x.*y)./(norm(x)^2 + norm(y)^2 - (x.*y)) , x, y);
Thanks for your opinions in advance.