forked from hexiangnan/neural_collaborative_filtering
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.py
More file actions
46 lines (34 loc) · 1.58 KB
/
Copy pathcli.py
File metadata and controls
46 lines (34 loc) · 1.58 KB
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
from typing import Literal
from tap import Tap
class BaseArgs(Tap):
path: str = 'Data/' # Input data path
dataset: str = 'ml-1m'
epochs: int = 100
batch_size: int = 256
num_factors: int = 8 # Embedding size
num_neg: int = 4
'''Number of negative instances to pair with a positive instance'''
lr: float = 0.001 # Learning Rate
learner: Literal['adagrad', 'adam', 'rmsprop', 'sgd'] = 'adam' # Optimizer
verbose: int = 1
out: bool = True # Whether to save the trained model
class GMFArgs(BaseArgs):
regs: str = '[0,0]' # Regularization for each layer
class MLPArgs(BaseArgs):
regs: str = '[0, 0, 0, 0]' # Regularization for each layer
layers: str = '[64, 32, 16, 8]'
'''Size of each layer. Note that the first layer is the concatenation of
user and item embeddings. So layers[0]/2 is the embedding size.'''
reg_layers: str = '[0, 0, 0, 0]'
'''Regularization for each MLP layer. reg_layers[0] is the regularization
for embeddings.'''
class NeuMFArgs(BaseArgs):
layers: str = '[64, 32, 16, 8]'
'''Size of each layer. Note that the first layer is the concatenation of
user and item embeddings. So layers[0]/2 is the embedding size.'''
reg_layers: str = '[0, 0, 0, 0]'
'''Regularization for each MLP layer. reg_layers[0] is the regularization
for embeddings.'''
reg_mf: float = 0.0 # Regularization for MF embeddings
mlp_pretrain: str = '' # Pretrained model file for MLP part (optional)
mf_pretrain: str = '' # Pretrained model file for MF part (optional)