-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevaluate_lp.m
28 lines (28 loc) · 989 Bytes
/
evaluate_lp.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function evaluate_lp(input, varargin)
[network_name, train_ratio, output, others] = process_options(varargin, 'nn', 'train-test',...
'train_ratio', 1, 'output', false);
if strcmp(network_name, 'train-test')
load(input, '-mat', 'train', 'test')
train = eval('train');
test = eval('test');
else
load(input, '-mat', network_name)
net = eval(network_name);
[train, test] = split_network(net, 'un', 0.9);
end
if train_ratio<1
train = split_network(train, 'un', train_ratio);
end
[B, Q] = network_hashing(train, others{:});
[alg, ~] = process_options(others, 'alg', 'binary');
if strcmp(alg, 'binary')
result = evaluate_item(train, test, B, B, -1, 200);
else
result = evaluate_item(train, test, B, Q, -1, 200);
end
if output
save(output, 'result');
end
%fprintf('ndcg@50=%.4f,AUC=%.4f,MPR=%.4f\n', result.item_ndcg(1,50), result.item_auc, full(result.item_mpr))
fprintf('ndcg@50=%.4f,AUC=%.4f,MPR=%.4f\n', result.ndcg(1,50), result.auc, full(result.mpr))
end