Commit 3e757678 authored by Andrew Cohen's avatar Andrew Cohen
Browse files

>2 classes, amazon

parent ef61d2ed
......@@ -18,7 +18,7 @@ for i=1:length(words)
end
d(length(words),length(words))=0;
d(find(isinf(d)))=10;
d(find(isinf(d)))=3;
d=Regularize(d);
[kGap Gap S idx] = GapSpectral(d,6,1);
fprintf('kGap=%d\n',kGap);
......@@ -27,16 +27,19 @@ nClasses=max(idxKey);
idxCluster=SpectralCluster(d,nClasses);
idxPerms=perms(1:nClasses);
nCorrect=[];
rgCorrect=[];
rgWrong={};
for i=1:size(idxPerms,1)
idxMap = idxKey;
for j=1:size(idxPerms,2)
idx = find(idxKey==j);
idxMap(idx)=idxPerms(i,j);
end
nCorrect(i)=length(find(idxMap'==idxCluster));
rgCorrect(i)=length(find(idxMap'==idxCluster));
rgWrong{i}=find(idxMap'~=idxCluster);
end
nCorrect=max(nCorrect);
[nCorrect iBest]=max(rgCorrect);
idxWrong = rgWrong(iBest);
fid=fopen('results.txt','a');
fprintf(fid,'\n\n-------------------------\n')
......
......@@ -3,8 +3,8 @@ tic
% goNWD
%
%
% global strServer
% strServer='amazon'
global strServer
strServer='amazon'
global QueryCache
if isempty(QueryCache)
QueryCache.Queries={};
......@@ -21,15 +21,20 @@ words1={'Macbeth','The Tempest','Othello','King Lear','Hamlet'...
words2={'Carrie','Salems Lot','The Shining','The Stand','The Dead Zone',...
'Firestarter','Cujo'}
% words3={'Anna Karenina','War and Peace','The Death of Ivan Ilyich','Hadji Murad'}
words3 = {'The Old Man and The Sea','The Sun Also Rises','For Whom the Bell Tolls'}
idxKey = [ones(1,length(words1)) 2*ones(1,length(words2)) 3*ones(1,length(words3))]
words3={'Adventures of Huckleberry Finn','A Connecticut Yankee in King Arthurs Court','Life on the Mississippi'...
'Puddnhead Wilson'}
words4 = {'The Old Man and The Sea','The Sun Also Rises','For Whom the Bell Tolls','A Farewell To Arms'}
words5={'Anna Karenina','War and Peace','The Death of Ivan Ilyich'}
idxKey = [ones(1,length(words1)) 2*ones(1,length(words2)) 3*ones(1,length(words3)) 4*ones(1,length(words4)) 5*ones(1,length(words5))]
GetCount(words1)
GetCount(words2)
%
[d]=GetDistances([words1,words2,words3],idxKey);
[d]=GetDistances([words1,words2,words3,words4,words5],idxKey);
idx=getDistancesPairs([words1,words2,words3],idxKey);
idx=getDistancesPairs([words1,words2,words3,words4,words5],idxKey);
......@@ -8,18 +8,21 @@ strServer='wikipedia'
words1={'red','orange','yellow','green','blue','indigo'}
words2={'lion','tiger','bear','monkey','zebra','elephant','aardvark','lamb','fox','ape','dog'}
[d1,d2]=GetDistances(words1,words2);
idx=getDistancesPairs(words1,words2);
idxKey = [ones(1,length(words1)) 2*ones(1,length(words2))]
d=GetDistances([words1,words2],idxKey);
idx=getDistancesPairs([words1,words2],idxKey);
words1={'red','orange','yellow','green','blue','indigo','violet','purple','cyan','white'}
words2={'square','circle','rectangle','ellipse','triangle','rhombus'}
[d1,d2]=GetDistances(words1,words2);
idx=getDistancesPairs(words1,words2);
idxKey = [ones(1,length(words1)) 2*ones(1,length(words2))]
d=GetDistances([words1,words2],idxKey);
idx=getDistancesPairs([words1,words2],idxKey);
words1={'Barack Obama','Hillary Clinton','John Edwards','Joe Biden','Chris Dodd','Mike Gravel'}
words2={'John McCain','Mitt Romney','Mike Huckabee','Ron Paul','Fred Thompson','Alan Keyes'}
[d1,d2]=GetDistances(words1,words2);
idx=getDistancesPairs(words1,words2);
idxKey = [ones(1,length(words1)) 2*ones(1,length(words2))]
d=GetDistances([words1,words2],idxKey);
idx=getDistancesPairs([words1,words2],idxKey);
%
% words1={'Labidochromis caeruleus','Sciaenochromis fryeri','Betta splendens','Carassius auratus','Melanochromis cyaneorhabdos'}
......
......@@ -230,3 +230,147 @@ GetDistances::(pairs)
Macbeth,The Tempest,Othello,King Lear,Hamlet,The Merchant of Venice,A Midsummer Nights Dream,Much Ado About Nothing,Taming of the Shrew,Twelfth Night,Carrie,Salems Lot,The Shining,The Stand,The Dead Zone,Firestarter,Cujo,The Old Man and The Sea,The Sun Also Rises,For Whom the Bell Tolls,kGap=3
nQueryCount=0, nCacheCount=1140
nCorrect=19
-------------------------
GetDistances::(multiples) NW=5
2014 9 20 13 51 16.765
Macbeth,The Tempest,Othello,King Lear,Hamlet,The Merchant of Venice,A Midsummer Nights Dream,Much Ado About Nothing,Taming of the Shrew,Twelfth Night,Carrie,Salems Lot,The Shining,The Stand,The Dead Zone,Firestarter,Cujo,The Old Man and The Sea,The Sun Also Rises,For Whom the Bell Tolls,nQueryCount=390, nCacheCount=1490
[10 0 0;7 0 0;3 0 0]
-------------------------
GetDistances::(multiples) NW=5
2014 9 20 15 13 43.665
Macbeth,The Tempest,Othello,King Lear,Hamlet,The Merchant of Venice,A Midsummer Nights Dream,Much Ado About Nothing,Taming of the Shrew,Twelfth Night,Carrie,Salems Lot,The Shining,The Stand,The Dead Zone,Firestarter,Cujo,Anna Karenina,War and Peace,The Death of Ivan Ilyich,The Old Man and The Sea,The Sun Also Rises,For Whom the Bell Tolls,A Farewell To Arms,nQueryCount=254, nCacheCount=2530
[10 0 0 0;0 7 0 0;0 1 2 0;0 0 0 4]
-------------------------
GetDistances::(pairs)
2014 9 22 15 21 12.231
Macbeth,The Tempest,Othello,King Lear,Hamlet,The Merchant of Venice,A Midsummer Nights Dream,Much Ado About Nothing,Taming of the Shrew,Twelfth Night,Carrie,Salems Lot,The Shining,The Stand,The Dead Zone,Firestarter,Cujo,Anna Karenina,War and Peace,The Death of Ivan Ilyich,The Old Man and The Sea,The Sun Also Rises,For Whom the Bell Tolls,A Farewell To Arms,kGap=3
nQueryCount=0, nCacheCount=1656
nCorrect=13
-------------------------
GetDistances::(multiples) NW=5
2014 9 22 16 1 55.121
Macbeth,The Tempest,Othello,King Lear,Hamlet,The Merchant of Venice,A Midsummer Nights Dream,Much Ado About Nothing,Taming of the Shrew,Twelfth Night,Carrie,Salems Lot,The Shining,The Stand,The Dead Zone,Firestarter,Cujo,Adventures of Huckleberry Finn,A Connecticut Yankee in King Arthurs Court,Life on the Mississippi,Puddnhead Wilson,The Old Man and The Sea,The Sun Also Rises,For Whom the Bell Tolls,A Farewell To Arms,nQueryCount=216, nCacheCount=2784
[10 0 0 0;0 7 0 0;0 0 4 0;0 0 0 4]
-------------------------
GetDistances::(pairs)
2014 9 22 17 5 40.826
Macbeth,The Tempest,Othello,King Lear,Hamlet,The Merchant of Venice,A Midsummer Nights Dream,Much Ado About Nothing,Taming of the Shrew,Twelfth Night,Carrie,Salems Lot,The Shining,The Stand,The Dead Zone,Firestarter,Cujo,Adventures of Huckleberry Finn,A Connecticut Yankee in King Arthurs Court,Life on the Mississippi,Puddnhead Wilson,The Old Man and The Sea,The Sun Also Rises,For Whom the Bell Tolls,A Farewell To Arms,kGap=4
nQueryCount=84, nCacheCount=1716
nCorrect=24
-------------------------
GetDistances::(multiples) NW=5
2014 9 22 17 10 39.019
Macbeth,The Tempest,Othello,King Lear,Hamlet,The Merchant of Venice,A Midsummer Nights Dream,Much Ado About Nothing,Taming of the Shrew,Twelfth Night,Carrie,Salems Lot,The Shining,The Stand,The Dead Zone,Firestarter,Cujo,Adventures of Huckleberry Finn,A Connecticut Yankee in King Arthurs Court,Life on the Mississippi,Puddnhead Wilson,The Old Man and The Sea,The Sun Also Rises,For Whom the Bell Tolls,A Farewell To Arms,Anna Karenina,War and Peace,The Death of Ivan Ilyich,nQueryCount=31, nCacheCount=3833
[10 0 0 0 0;0 7 0 0 0;0 0 4 0 0;0 0 0 4 0;0 1 0 0 2]
-------------------------
GetDistances::(pairs)
2014 9 22 17 12 56.638
Macbeth,The Tempest,Othello,King Lear,Hamlet,The Merchant of Venice,A Midsummer Nights Dream,Much Ado About Nothing,Taming of the Shrew,Twelfth Night,Carrie,Salems Lot,The Shining,The Stand,The Dead Zone,Firestarter,Cujo,Adventures of Huckleberry Finn,A Connecticut Yankee in King Arthurs Court,Life on the Mississippi,Puddnhead Wilson,The Old Man and The Sea,The Sun Also Rises,For Whom the Bell Tolls,A Farewell To Arms,Anna Karenina,War and Peace,The Death of Ivan Ilyich,kGap=4
nQueryCount=24, nCacheCount=2244
nCorrect=20
-------------------------
GetDistances::(pairs)
2014 9 22 17 26 38.42
Macbeth,The Tempest,Othello,King Lear,Hamlet,The Merchant of Venice,A Midsummer Nights Dream,Much Ado About Nothing,Taming of the Shrew,Twelfth Night,Carrie,Salems Lot,The Shining,The Stand,The Dead Zone,Firestarter,Cujo,Adventures of Huckleberry Finn,A Connecticut Yankee in King Arthurs Court,Life on the Mississippi,Puddnhead Wilson,The Old Man and The Sea,The Sun Also Rises,For Whom the Bell Tolls,A Farewell To Arms,Anna Karenina,War and Peace,The Death of Ivan Ilyich,kGap=3
nQueryCount=0, nCacheCount=2268
nCorrect=18
-------------------------
GetDistances::(pairs)
2014 9 22 17 27 5.218
Macbeth,The Tempest,Othello,King Lear,Hamlet,The Merchant of Venice,A Midsummer Nights Dream,Much Ado About Nothing,Taming of the Shrew,Twelfth Night,Carrie,Salems Lot,The Shining,The Stand,The Dead Zone,Firestarter,Cujo,Adventures of Huckleberry Finn,A Connecticut Yankee in King Arthurs Court,Life on the Mississippi,Puddnhead Wilson,The Old Man and The Sea,The Sun Also Rises,For Whom the Bell Tolls,A Farewell To Arms,Anna Karenina,War and Peace,The Death of Ivan Ilyich,kGap=3
nQueryCount=0, nCacheCount=2268
nCorrect=17
-------------------------
GetDistances::(pairs)
2014 9 22 17 27 28.914
Macbeth,The Tempest,Othello,King Lear,Hamlet,The Merchant of Venice,A Midsummer Nights Dream,Much Ado About Nothing,Taming of the Shrew,Twelfth Night,Carrie,Salems Lot,The Shining,The Stand,The Dead Zone,Firestarter,Cujo,Adventures of Huckleberry Finn,A Connecticut Yankee in King Arthurs Court,Life on the Mississippi,Puddnhead Wilson,The Old Man and The Sea,The Sun Also Rises,For Whom the Bell Tolls,A Farewell To Arms,Anna Karenina,War and Peace,The Death of Ivan Ilyich,kGap=4
nQueryCount=0, nCacheCount=2268
nCorrect=20
-------------------------
GetDistances::(pairs)
2014 9 22 17 28 13.15
Macbeth,The Tempest,Othello,King Lear,Hamlet,The Merchant of Venice,A Midsummer Nights Dream,Much Ado About Nothing,Taming of the Shrew,Twelfth Night,Carrie,Salems Lot,The Shining,The Stand,The Dead Zone,Firestarter,Cujo,Adventures of Huckleberry Finn,A Connecticut Yankee in King Arthurs Court,Life on the Mississippi,Puddnhead Wilson,The Old Man and The Sea,The Sun Also Rises,For Whom the Bell Tolls,A Farewell To Arms,Anna Karenina,War and Peace,The Death of Ivan Ilyich,kGap=4
nQueryCount=0, nCacheCount=2268
nCorrect=20
-------------------------
GetDistances::(multiples) NW=5
2014 9 25 23 10 5.802
red,orange,yellow,green,blue,indigo,lion,tiger,bear,monkey,zebra,elephant,aardvark,lamb,fox,ape,dog,nQueryCount=256, nCacheCount=1036
[6 0;11 0]
-------------------------
GetDistances::(multiples) NW=5
2014 9 25 23 47 26.612
red,orange,yellow,green,blue,indigo,lion,tiger,bear,monkey,zebra,elephant,aardvark,lamb,fox,ape,dog,nQueryCount=255, nCacheCount=1037
[6 0;0 11]
-------------------------
GetDistances::(pairs)
2014 9 26 0 18 42.703
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 9 26 1 24 4.373
red,orange,yellow,green,blue,indigo,violet,purple,cyan,white,square,circle,rectangle,ellipse,triangle,rhombus,nQueryCount=224, nCacheCount=928
[10 0;0 6]
-------------------------
GetDistances::(pairs)
2014 9 26 1 30 10.168
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 9 26 1 34 26.147
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=140, nCacheCount=532
[6 0;0 6]
-------------------------
GetDistances::(pairs)
2014 9 26 2 33 20.065
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment