-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathtest.m
More file actions
33 lines (30 loc) · 826 Bytes
/
test.m
File metadata and controls
33 lines (30 loc) · 826 Bytes
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
29
30
31
32
33
M = 300;
m_num_users = 5551;
m_num_items = 16980;
train_users = cell(m_num_users,1);
fid=fopen('data/cf-train-1-users.dat','r'); % user train file
for i=1:m_num_users
tline = fgetl(fid);
if ~ischar(tline), break, end
liked = str2num(tline);
liked(2:end) = liked(2:end)+1;
train_users{i} = liked;
end
fclose(fid);
test_users = cell(m_num_users,1);
fid=fopen('data/cf-test-1-users.dat','r'); % user test file
for i=1:m_num_users
tline = fgetl(fid);
if ~ischar(tline), break, end
liked = str2num(tline);
liked(2:end) = liked(2:end)+1;
test_users{i} = liked;
end
fclose(fid);
x = 50:50:M;
% 'cvae.mat' is the "pmf.mat" file saved by the model
S = load('cvae.mat');
m_U = S.m_U;
m_V = S.m_V;
[recall_cvae, ~] = evaluate(train_users, test_users, m_U, m_V, M);
recall_cvae = recall_cvae(x);