Commit 722e8884 authored by Andrew Cohen's avatar Andrew Cohen
Browse files

added output format, moved cache before throttle

parent 059795a6
......@@ -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();
......@@ -16,16 +25,7 @@ if ~isempty(timerVal)
if deltaT>0
pause(deltaT);
end
end
if isempty(mapCache)
mapCache=containers.Map();
end
if mapCache.isKey(term)
nUps=mapCache(term);
return;
end
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
Supports Markdown
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