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

updates for NWDmin

parent f99db594
Branches
No related tags found
No related merge requests found
......@@ -44,6 +44,10 @@ for i=1:length(words)
% w2=w2(1:NW);
% w2x=w2x(1:NW);
% NWD1x(i)=NWD(w1x)-NWD(w1x,1);
% NWD1(i)=NWD(w1)-NWD(w1,1);
% NWD2x(i)=NWD(w2x)-NWD(w2x,1);
% NWD2(i)=NWD(w2)-NWD(w2,1);
NWD1x(i)=NWD(w1x);
NWD1(i)=NWD(w1);
NWD2x(i)=NWD(w2x);
......@@ -53,7 +57,9 @@ for i=1:length(words)
% d2(i)=(NWD2x(i)-NWD2(i))./max(abs(NWD2x(i)),abs(NWD2(i)));;
d1(i)=(NWD1x(i)-NWD1(i));
d2(i)=(NWD2x(i)-NWD2(i));
if isnan(d2(i))
d2(i)=Inf;
end
if d1(i)<d2(i)
% if abs(d1(i))<abs(d2(i))
fprintf('1,');
......
function [nwd rgCache]=NWD(words, varargin)
if nargin<2
bNWDmin=0;
else
bNWDmin=varargin{1};
end
fX=GetCount(words);
fw=[];
......@@ -12,16 +17,14 @@ for i=1:length(words)
fexclude(i)=GetCount(ww);
end
% nwd=(fX-min(fw))/max(fexclude);
% nwd = ( fX - max(fw) ) / ( sum(fw) - max(fw));
% nwd= ( sum(fw) - fX ) / ( sum(fw) - max(fw) );
% N=length(words);
% denom=sum(fw);
% nwd=(N/(N-1))*(fX/denom-1/N);
% nwd=(fX/denom);
N=GetCount({'N'});
if bNWDmin
nwd = (log2(min(fw))-log2(fX)) / (log2(N)-log2(min(fw))); % from xx.pdf
else
nwd = (log2(max(fw))-log2(fX)) / (log2(N)-log2(min(fw))); % III.3 from arxiv
end
% normalize for cardinality
nwd = nwd/(length(words)-1);
% nwd=(log2(max(fw))-log2(fX))/( log2(N)-log2(max(fexclude)) );
% below with normalizatino
-------------------------
GetDistances::(multiples) NW=5
2014 8 12 14 18 2.463
red,orange,yellow,green,blue,indigo,lion,tiger,bear,monkey,zebra,elephant,aardvark,lamb,fox,ape,dog,nQueryCount=394, nCacheCount=898
[6 0;0 11]
-------------------------
GetDistances::(pairs)
2014 8 12 14 19 11.238
red,orange,yellow,green,blue,indigo,lion,tiger,bear,monkey,zebra,elephant,aardvark,lamb,fox,ape,dog,kGap=2
nQueryCount=136, nCacheCount=680
nCorrect=17
-------------------------
GetDistances::(multiples) NW=5
2014 8 12 14 22 21.367
red,orange,yellow,green,blue,indigo,violet,purple,cyan,white,square,circle,rectangle,ellipse,triangle,rhombus,nQueryCount=342, nCacheCount=810
[10 0;0 6]
-------------------------
GetDistances::(pairs)
2014 8 12 14 23 16.088
red,orange,yellow,green,blue,indigo,violet,purple,cyan,white,square,circle,rectangle,ellipse,triangle,rhombus,kGap=2
nQueryCount=105, nCacheCount=615
nCorrect=16
-------------------------
GetDistances::(multiples) NW=5
2014 8 12 14 25 20.728
Barack Obama,Hillary Clinton,John Edwards,Joe Biden,Chris Dodd,Mike Gravel,John McCain,Mitt Romney,Mike Huckabee,Ron Paul,Fred Thompson,Alan Keyes,nQueryCount=198, nCacheCount=474
[6 0;0 6]
-------------------------
GetDistances::(pairs)
2014 8 12 14 26 2.281
Barack Obama,Hillary Clinton,John Edwards,Joe Biden,Chris Dodd,Mike Gravel,John McCain,Mitt Romney,Mike Huckabee,Ron Paul,Fred Thompson,Alan Keyes,kGap=2
nQueryCount=66, nCacheCount=330
nCorrect=7
%below without normalization
-------------------------
GetDistances::(multiples) NW=5
2014 8 12 14 35 5.938
red,orange,yellow,green,blue,indigo,lion,tiger,bear,monkey,zebra,elephant,aardvark,lamb,fox,ape,dog,nQueryCount=394, nCacheCount=898
2014 9 5 22 18 10.438
red,orange,yellow,green,blue,indigo,lion,tiger,bear,monkey,zebra,elephant,aardvark,lamb,fox,ape,dog,nQueryCount=0, nCacheCount=1292
[6 0;0 11]
-------------------------
GetDistances::(pairs)
2014 8 12 14 36 17.183
red,orange,yellow,green,blue,indigo,lion,tiger,bear,monkey,zebra,elephant,aardvark,lamb,fox,ape,dog,kGap=2
nQueryCount=136, nCacheCount=680
nCorrect=17
-------------------------
GetDistances::(multiples) NW=5
2014 8 12 14 39 32.895
red,orange,yellow,green,blue,indigo,violet,purple,cyan,white,square,circle,rectangle,ellipse,triangle,rhombus,nQueryCount=342, nCacheCount=810
2014 9 5 22 21 31.57
red,orange,yellow,green,blue,indigo,violet,purple,cyan,white,square,circle,rectangle,ellipse,triangle,rhombus,nQueryCount=320, nCacheCount=832
[10 0;0 6]
-------------------------
GetDistances::(pairs)
2014 8 12 14 40 25.069
red,orange,yellow,green,blue,indigo,violet,purple,cyan,white,square,circle,rectangle,ellipse,triangle,rhombus,kGap=1
nQueryCount=105, nCacheCount=615
nCorrect=16
-------------------------
GetDistances::(multiples) NW=5
2014 8 12 14 42 30.533
2014 9 5 22 23 50.569
Barack Obama,Hillary Clinton,John Edwards,Joe Biden,Chris Dodd,Mike Gravel,John McCain,Mitt Romney,Mike Huckabee,Ron Paul,Fred Thompson,Alan Keyes,nQueryCount=198, nCacheCount=474
[6 0;0 6]
......@@ -92,7 +26,7 @@ Barack Obama,Hillary Clinton,John Edwards,Joe Biden,Chris Dodd,Mike Gravel,John
-------------------------
GetDistances::(pairs)
2014 8 12 14 43 12.117
2014 9 5 22 24 38.426
Barack Obama,Hillary Clinton,John Edwards,Joe Biden,Chris Dodd,Mike Gravel,John McCain,Mitt Romney,Mike Huckabee,Ron Paul,Fred Thompson,Alan Keyes,kGap=2
nQueryCount=66, nCacheCount=330
nCorrect=7
......@@ -100,7 +34,7 @@ nCorrect=7
-------------------------
GetDistances::(multiples) NW=5
2014 8 13 11 57 7.353
2014 9 5 22 29 12.913
red,orange,yellow,green,blue,indigo,lion,tiger,bear,monkey,zebra,elephant,aardvark,lamb,fox,ape,dog,nQueryCount=0, nCacheCount=1292
[6 0;0 11]
......@@ -108,31 +42,7 @@ red,orange,yellow,green,blue,indigo,lion,tiger,bear,monkey,zebra,elephant,aardva
-------------------------
GetDistances::(pairs)
2014 8 13 11 57 9.352
red,orange,yellow,green,blue,indigo,lion,tiger,bear,monkey,zebra,elephant,aardvark,lamb,fox,ape,dog,kGap=2
nQueryCount=0, nCacheCount=816
nCorrect=17
-------------------------
GetDistances::(multiples) NW=5
2014 8 13 11 57 9.427
red,orange,yellow,green,blue,indigo,violet,purple,cyan,white,square,circle,rectangle,ellipse,triangle,rhombus,nQueryCount=0, nCacheCount=1152
[10 0;0 6]
-------------------------
GetDistances::(multiples) NW=5
2014 8 13 12 2 16.924
red,orange,yellow,green,blue,indigo,lion,tiger,bear,monkey,zebra,elephant,aardvark,lamb,fox,ape,dog,nQueryCount=394, nCacheCount=898
[6 0;0 11]
-------------------------
GetDistances::(pairs)
2014 8 13 12 3 31.293
2014 9 5 22 30 36.213
red,orange,yellow,green,blue,indigo,lion,tiger,bear,monkey,zebra,elephant,aardvark,lamb,fox,ape,dog,kGap=2
nQueryCount=136, nCacheCount=680
nCorrect=17
......@@ -140,15 +50,15 @@ nCorrect=17
-------------------------
GetDistances::(multiples) NW=5
2014 8 13 12 6 44.511
red,orange,yellow,green,blue,indigo,violet,purple,cyan,white,square,circle,rectangle,ellipse,triangle,rhombus,nQueryCount=342, nCacheCount=810
2014 9 5 22 30 36.384
red,orange,yellow,green,blue,indigo,violet,purple,cyan,white,square,circle,rectangle,ellipse,triangle,rhombus,nQueryCount=0, nCacheCount=1152
[10 0;0 6]
-------------------------
GetDistances::(pairs)
2014 8 13 12 7 39.17
2014 9 5 22 31 38.331
red,orange,yellow,green,blue,indigo,violet,purple,cyan,white,square,circle,rectangle,ellipse,triangle,rhombus,kGap=1
nQueryCount=105, nCacheCount=615
nCorrect=16
......@@ -156,15 +66,15 @@ nCorrect=16
-------------------------
GetDistances::(multiples) NW=5
2014 8 13 12 9 46.467
Barack Obama,Hillary Clinton,John Edwards,Joe Biden,Chris Dodd,Mike Gravel,John McCain,Mitt Romney,Mike Huckabee,Ron Paul,Fred Thompson,Alan Keyes,nQueryCount=198, nCacheCount=474
2014 9 5 22 31 38.411
Barack Obama,Hillary Clinton,John Edwards,Joe Biden,Chris Dodd,Mike Gravel,John McCain,Mitt Romney,Mike Huckabee,Ron Paul,Fred Thompson,Alan Keyes,nQueryCount=0, nCacheCount=672
[6 0;0 6]
-------------------------
GetDistances::(pairs)
2014 8 13 12 10 28.391
2014 9 5 22 31 40.923
Barack Obama,Hillary Clinton,John Edwards,Joe Biden,Chris Dodd,Mike Gravel,John McCain,Mitt Romney,Mike Huckabee,Ron Paul,Fred Thompson,Alan Keyes,kGap=2
nQueryCount=66, nCacheCount=330
nQueryCount=0, nCacheCount=396
nCorrect=7
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment