-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathmain_caser.m
47 lines (42 loc) · 1.59 KB
/
main_caser.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
clear; clc;
%% dataset related arguments
train_path = 'data/ml1m/validation/train.txt';
test_path = 'data/ml1m/validation/test.txt';
rate_once = 1; % whether each item will only be rated once by each user
L = 5; % length of sequence
T = 3; % number of targets
%% training arguments
seed = 1234; % random seed
n_iter = 50; % number of iteration
learning_rate = 1e-3; % learning rate for ADAM
l2 = 1e-6; % l2 norm weight
neg_samples = 3; % negative samples per target
early_stop = true; % whether to perform early stop during training
%% Caser related arguments
d = 50; % number of latent dimensions
nv = 4; % number of vertical filters
nh = 16; % number of horizontal filters
ac_conv = 'relu'; % activation function for convolution layer (i.e., phi_c in paper)
ac_fc = 'relu'; % activation function for fully-connected layer (i.e., phi_a in paper)
drop_rate = 0.5; % drop ratio when performing dropout
%% Perform training
args = struct(...
'trainpath',train_path,...
'testpath',test_path,...
'rateonce',rate_once,...
'L',L,...
'T', T,...
'seed',seed,...
'niter',n_iter,...
'lrate',learning_rate,...
'l2',l2,...
'negsample',neg_samples,...
'earlystop',early_stop,...
'd',d,...
'nv',nv,...
'nh',nh,...
'acconv',ac_conv,...
'acfc',ac_fc,...
'droprate',drop_rate...
);
caser_train(args);