def __init__(self, neg_emb, neg_layer, hidden_size, num_layers, p_layers, *args, **kwargs): self.neg_emb = neg_emb self.hidden_size = hidden_size self.num_layers = num_layers self.p_layers = p_layers if type(p_layers) == list else eval(p_layers) self.neg_layer = neg_layer if type(neg_layer) == list else eval(neg_layer) RecModel.__init__(self, *args, **kwargs)
def __init__(self, user_feature_num, item_feature_num, feature_dims, f_vector_size, cb_hidden_layers, attention_size, cs_ratio, *args, **kwargs): self.user_feature_num = user_feature_num self.item_feature_num = item_feature_num self.feature_dims = feature_dims self.f_vector_size = f_vector_size self.cb_hidden_layers = cb_hidden_layers if type( cb_hidden_layers) == list else eval(cb_hidden_layers) self.attention_size = attention_size self.cs_ratio = cs_ratio RecModel.__init__(self, *args, **kwargs)
def __init__(self, hash_u_num, hash_layers, tree_layers, transfer_att_size, cs_ratio, sample_max_n, sample_r_n, *args, **kwargs): self.hash_u_num = hash_u_num self.hash_layers = hash_layers if type(hash_layers) == list else eval( hash_layers) self.tree_layers = tree_layers if type(tree_layers) == list else eval( tree_layers) self.sample_max_n, self.sample_r_n = sample_max_n, sample_r_n self.transfer_att_size = transfer_att_size self.cs_ratio = cs_ratio self.rec_paras_record, self.hash_paras_record = {}, {} RecModel.__init__(self, *args, **kwargs)
def __init__(self, layers, p_layers, hash_u_num, hash_layers, tree_layers, transfer_att_size, cs_ratio, sample_max_n, sample_r_n, *args, **kwargs): self.layers = layers if type(layers) == list else eval(layers) self.p_layers = p_layers if type(p_layers) == list else eval(p_layers) self.hash_u_num = hash_u_num self.hash_layers = hash_layers if type(hash_layers) == list else eval( hash_layers) self.tree_layers = tree_layers if type(tree_layers) == list else eval( tree_layers) self.transfer_att_size = transfer_att_size self.sample_max_n, self.sample_r_n = sample_max_n, sample_r_n self.cs_ratio = cs_ratio RecModel.__init__(self, *args, **kwargs)
def parse_model_args(parser, model_name='PreHash'): parser.add_argument('--hash_u_num', type=int, default=128, help='Size of user hash.') parser.add_argument('--sample_max_n', type=int, default=128, help='Sample top-n when learn hash.') parser.add_argument('--sample_r_n', type=int, default=128, help='Sample random-n when learn hash.') parser.add_argument('--hash_layers', type=str, default='[32]', help='MLP layer sizes of hash') parser.add_argument( '--tree_layers', type=str, default='[64]', help='Number of branches in each level of the hash tree') parser.add_argument( '--transfer_att_size', type=int, default=16, help= 'Size of attention layer of transfer layer (combine the hash and cf vector)' ) parser.add_argument('--cs_ratio', type=float, default=0.1, help='Cold-Sampling ratio of each batch.') return RecModel.parse_model_args(parser, model_name)
def parse_model_args(parser, model_name='GRU4Rec'): parser.add_argument('--hidden_size', type=int, default=64, help='Size of hidden vectors in GRU.') parser.add_argument('--num_layers', type=int, default=1, help='Number of GRU layers.') parser.add_argument('--p_layers', type=str, default='[64]', help="Size of each layer.") parser.add_argument( '--neg_emb', type=int, default=1, help="Whether use negative interaction embeddings.") parser.add_argument( '--neg_layer', type=str, default='[]', help= "Whether use a neg_layer to transfer negative interaction embeddings. " "[] means using -v. It is ignored when neg_emb=1") return RecModel.parse_model_args(parser, model_name)
def __init__(self, user_feature_num, item_feature_num, feature_dims, f_vector_size, cb_hidden_layers, attention_size, cs_ratio, hash_u_num, hash_layers, tree_layers, transfer_att_size, sample_max_n, sample_r_n, *args, **kwargs): self.user_feature_num = user_feature_num self.item_feature_num = item_feature_num self.feature_dims = feature_dims self.f_vector_size = f_vector_size self.cb_hidden_layers = cb_hidden_layers if type(cb_hidden_layers) == list else eval(cb_hidden_layers) self.attention_size = attention_size self.cs_ratio = cs_ratio self.hash_u_num = hash_u_num self.hash_layers = hash_layers if type(hash_layers) == list else eval(hash_layers) self.tree_layers = tree_layers if type(tree_layers) == list else eval(tree_layers) self.transfer_att_size = transfer_att_size self.sample_max_n, self.sample_r_n = sample_max_n, sample_r_n RecModel.__init__(self, *args, **kwargs)
def parse_model_args(parser, model_name='NeuMF'): parser.add_argument('--layers', type=str, default='[64]', help="Size of mlp layers.") parser.add_argument('--p_layers', type=str, default='[]', help="Size of prediction mlp layers.") return RecModel.parse_model_args(parser, model_name)
def __init__(self, class_num, feature_num, user_num, item_num, u_vector_size, i_vector_size, user_feature_num, item_feature_num, feature_dims, f_vector_size, cb_hidden_layers, attention_size, cs_ratio, random_seed, model_path): self.user_feature_num = user_feature_num self.item_feature_num = item_feature_num self.feature_dims = feature_dims self.f_vector_size = f_vector_size self.cb_hidden_layers = cb_hidden_layers self.attention_size = attention_size self.cs_ratio = cs_ratio RecModel.__init__(self, class_num=class_num, feature_num=feature_num, user_num=user_num, item_num=item_num, u_vector_size=u_vector_size, i_vector_size=i_vector_size, random_seed=random_seed, model_path=model_path)
def parse_model_args(parser, model_name='ACCM'): parser.add_argument('--f_vector_size', type=int, default=64, help='Size of feature vectors.') parser.add_argument('--cb_hidden_layers', type=str, default='[]', help="Number of CB part's hidden layer.") parser.add_argument('--attention_size', type=int, default=16, help='Size of attention layer.') parser.add_argument('--cs_ratio', type=float, default=0.1, help='Cold-Sampling ratio of each batch.') return RecModel.parse_model_args(parser, model_name)
def __init__(self, layers, p_layers, *args, **kwargs): self.layers = layers if type(layers) == list else eval(layers) self.p_layers = p_layers if type(p_layers) == list else eval(p_layers) RecModel.__init__(self, *args, **kwargs)