Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
OpenSource
NWD
Commits
722e8884
Commit
722e8884
authored
Apr 05, 2019
by
Andrew Cohen
Browse files
added output format, moved cache before throttle
parent
059795a6
Changes
4
Hide whitespace changes
Inline
Side-by-side
+Count/pubmed.m
View file @
722e8884
...
...
@@ -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
();
...
...
+Count/reddit.m
View file @
722e8884
...
...
@@ -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
);
...
...
+Distance/GetDistances.m
View file @
722e8884
...
...
@@ -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.m
0 → 100644
View file @
722e8884
% 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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment