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

added output format, moved cache before throttle

parent 059795a6
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,15 @@ function count=pubmed(term)
count=0;
persistent creds timerVal mapCache
if isempty(mapCache)
mapCache=containers.Map();
end
if 0 && mapCache.isKey(term)
count=mapCache(term);
return;
end
if isempty(creds)
[creds.email,creds.appID]=getPubmedCredentials();
end
......@@ -15,14 +24,6 @@ if ~isempty(timerVal)
pause(deltaT);
end
end
if isempty(mapCache)
mapCache=containers.Map();
end
if mapCache.isKey(term)
count=mapCache(term);
return;
end
dd=query(term,creds);
timerVal=tic();
......
......@@ -4,6 +4,15 @@ nComments=0;
nUps=0;
persistent creds timerVal token mapCache
if isempty(mapCache)
mapCache=containers.Map();
end
if mapCache.isKey(term)
nUps=mapCache(term);
return;
end
if isempty(creds)
[creds.client_id,creds.secret]=getRedditCredentials();
......@@ -17,15 +26,6 @@ if ~isempty(timerVal)
pause(deltaT);
end
end
if isempty(mapCache)
mapCache=containers.Map();
end
if mapCache.isKey(term)
nUps=mapCache(term);
return;
end
if isempty(token)
token=getToken(creds.client_id,creds.secret);
......
......@@ -29,9 +29,9 @@ for i=1:length(words)
idx=find(isnan(d) | isinf(d));
d(idx)=inf;
[mm idx]=min(d(:,i));
fprintf('%d,',idx);
% fprintf('%d,',idx);
end
fprintf('\n');
% fprintf('\n');
Confusion=zeros(nClasses,nClasses);
for i=1:length(words)
......
% formatResults
fprintf(1,'[multiset NWD accuracy, spectral (pairwise NWD) accuracy, nearest neighbor (pairwise NWD) accuracy\n');
for iExperiment=1:length(exp)
fprintf('\n')
fprintf(1,'%s\n',exp(iExperiment).label);
nWords=sum(cellfun(@length,exp(iExperiment).words));
for iServer=1:length(servers)
fprintf(1,' %s:[%3.2f,%3.2f,%3.2f]\t ',servers{iServer},results{iExperiment,iServer}./nWords);
end
fprintf('\n')
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment