Skip to content
Snippets Groups Projects
Commit 2ab7ed0c authored by Andrew Cohen's avatar Andrew Cohen
Browse files

check for NaN on distances, make it Inf

parent b30f0a16
Branches
No related tags found
No related merge requests found
...@@ -55,10 +55,12 @@ for i=1:length(words) ...@@ -55,10 +55,12 @@ for i=1:length(words)
d1(i)=(NWD1x(i)-NWD1(i)); d1(i)=(NWD1x(i)-NWD1(i));
d2(i)=(NWD2x(i)-NWD2(i)); d2(i)=(NWD2x(i)-NWD2(i));
if isnan(d1(i)) % f(X)=0 --> -log2(0)==Inf , Inf-Inf=NaN
d1(i)=Inf;
end
if isnan(d2(i)) % f(X)=0 --> -log2(0)==Inf if isnan(d2(i)) % f(X)=0 --> -log2(0)==Inf
d2(i)=Inf; d2(i)=Inf;
end end
if d1(i)<d2(i) if d1(i)<d2(i)
% if abs(d1(i))<abs(d2(i)) % magnitude? % if abs(d1(i))<abs(d2(i)) % magnitude?
fprintf('1,'); fprintf('1,');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment