bug in fnn.m ?
Posted: Wed Apr 23, 2014 07:50
Dear Marwan
There seems to be a bug in fnn when computing the distance in dimension m+1(Line 536)
When computing FNN ratio, the code given is
if is(2) < NX & idx(i) < NX & distance(2) < x_s
FNN(m,1) = FNN(m,1) + double((abs(x(idx(i)+m) - x(is(2)+m))/distance(2) > r));
cnt = cnt + 1;
end
My question, when moving to m+1 dimension, should you not add m*t and not just m, so i guess that above code should read
if is(2) < NX & idx(i) < NX & distance(2) < x_s
FNN(m,1) = FNN(m,1) + double((abs(x(idx(i)+m*t) - x(is(2)+m*t))/distance(2) > r));
cnt = cnt + 1;
end
Kindly confirm if I am missing something on this.
There seems to be a bug in fnn when computing the distance in dimension m+1(Line 536)
When computing FNN ratio, the code given is
if is(2) < NX & idx(i) < NX & distance(2) < x_s
FNN(m,1) = FNN(m,1) + double((abs(x(idx(i)+m) - x(is(2)+m))/distance(2) > r));
cnt = cnt + 1;
end
My question, when moving to m+1 dimension, should you not add m*t and not just m, so i guess that above code should read
if is(2) < NX & idx(i) < NX & distance(2) < x_s
FNN(m,1) = FNN(m,1) + double((abs(x(idx(i)+m*t) - x(is(2)+m*t))/distance(2) > r));
cnt = cnt + 1;
end
Kindly confirm if I am missing something on this.