leavingseason / openlearning4deeprecsys Goto Github PK
View Code? Open in Web Editor NEWSome deep learning based recsys for open learning.
Some deep learning based recsys for open learning.
I clone the repository and run deepFM.py with no change. But AUC is always 0.402291120098. Any suggestion?
I have tried to run the code on a server with 4 Nvidia GPUS and the performance drops 6 times with respect to using a CPU on a notebook.
Is there a way to exploit GPUs better?
Hi, I met with a strange problem while training deepFM model using ml-1m dataset: if enabling "is_use_fm_part" flag to True, the training process won't converge and the rmse value will become bigger and bigger(and the loss does decrease!). But if switching the flag off, just using dnn only, it seems ok. I only change the deepFM.py a little: For comparing the predicted rating with the GT value, I removed the softmax activation function for the last layer, and then output rmse error instead of auc.
I run it with python 2.7, but an error comes out: TypeError: makedirs() got an unexpected keyword argument 'exist_ok'
So you are using python 3?
i have tried your code DeepFM_BOW with criteo dataset .However , my best result is "global_auc : 0.78648". Could you please release your best params on criteo ?
The params I use is as follows:
params = {
'reg_w_linear': 0.0001, 'reg_w_fm':0.0001, 'reg_w_nn': 0.0001, #0.001
'reg_w_l1': 0.0001,
'init_value': 0.001,
'layer_sizes': [400,400],
'activations':['relu','tanh'],#
'eta': 0.1,
'n_epoch': 100, # 500
'batch_size': 4096,
'dim': 15,
'model_path': 'models',
'train_file': 'train.txt' ,#'data/demodata.fieldwise.txt',
'test_file': 'test.txt' ,# 'data/demodata.fieldwise.txt',
'output_predictions':False,
'is_use_fm_part':True,
'is_use_dnn_part':True,
'multi_level_num':1,
'learning_rate':0.0001, # [0.001, 0.01]
'loss': 'log_loss', # [cross_entropy_loss, square_loss, log_loss]
'optimizer':'adam', # [adam, ftrl, sgd]
'clean_cache':True,
'metrics': [
#{'name': 'individual_auc'},
{'name': 'global_auc'}
#, {'name': 'precision', 'k': 1}
#, {'name': 'precision', 'k': 5}
# , {'name': 'precision', 'k': 10}
]
}
looking forward to your reply
Hello, I have try to extend your ccfnet to cross-domain, but unfortunately, I find my model didn't work as good as ccfnet in single area. More specifically, the test RMSE is always high, I guess it may be suffering overfitting. As I have posted below, can you give me some instructions to help me better my code?
By the way, I just did what your paper said, spliting the Movielens movies into two disjointed set to simulate two area.
`def build_model(user_cf_feature_1, user_cf_feature_2, user_attr_feature_1, user_attr_feature_2, user_attr_rank,
item_cf_feature_1, item_cf_feature_2, item_attr_feature_1, item_attr_feature_2, item_attr_rank,
ratings_1, ratings_2, layer_size,
W_user, W_item_1, W_item_2,
W_user_attr, W_item_attr_1, W_item_attr_2,
lamb, lr, mu_1, mu_2):
layer_cnt = len(layer_size)
with tf.name_scope('View_1'):
hiddens_user_1 = []
hiddens_item_1 = []
hiddens_user_1.append(user_attr_feature_1)
hiddens_item_1.append(item_attr_feature_1)
b_user_list_1 = []
b_item_list_1 = []
W_user_list_1 = []
W_item_list_1 = []
for i in range(layer_cnt):
with tf.name_scope('layer_'+str(i)):
b_user_list_1.append(tf.Variable(tf.truncated_normal([layer_size[i]]), name='user_bias_1'))
b_item_list_1.append(tf.Variable(tf.truncated_normal([layer_size[i]]), name='item_bias_1'))
if i == 0:
W_user_list_1.append(tf.Variable(
tf.truncated_normal([user_attr_rank, layer_size[i]],
stddev=1/math.sqrt(float(layer_size[i])), mean=0), name='W_user_1'))
W_item_list_1.append(tf.Variable(
tf.truncated_normal([item_attr_rank, layer_size[i]],
stddev=1/math.sqrt(float(layer_size[i])), mean=0), name='W_item_1'))
user_middle = tf.matmul(user_attr_feature_1, W_user_list_1[i]) + b_user_list_1[i]
item_middle = tf.matmul(item_attr_feature_1, W_item_list_1[i]) + b_item_list_1[i]
else:
W_user_list_1.append(tf.Variable(
tf.truncated_normal([layer_size[i-1], layer_size[i]],
stddev=1/math.sqrt(float(layer_size[i])), mean=0), name='W_user_1'))
W_item_list_1.append(tf.Variable(
tf.truncated_normal([layer_size[i-1], layer_size[i]],
stddev=1/math.sqrt(float(layer_size[i])), mean=0), name='W_item_1'))
user_middle = tf.matmul(hiddens_user_1[i], W_user_list_1[i]) + b_user_list_1[i]
item_middle = tf.matmul(hiddens_item_1[i], W_item_list_1[i]) + b_item_list_1[i]
hiddens_user_1.append(tf.identity(user_middle, name='factor_user_1')) # identity ,sigmoid
hiddens_item_1.append(tf.identity(item_middle, name='factor_item_1'))
factor_user_1 = hiddens_user_1[layer_cnt]
factor_item_1 = hiddens_item_1[layer_cnt]
with tf.name_scope('View_2'):
hiddens_user_2 = []
hiddens_item_2 = []
hiddens_user_2.append(user_attr_feature_2)
hiddens_item_2.append(item_attr_feature_2)
b_user_list_2 = []
b_item_list_2 = []
W_user_list_2 = []
W_item_list_2 = []
for i in range(layer_cnt):
with tf.name_scope('layer_'+str(i)):
b_user_list_2.append(tf.Variable(tf.truncated_normal([layer_size[i]]), name='user_bias_2'))
b_item_list_2.append(tf.Variable(tf.truncated_normal([layer_size[i]]), name='item_bias_2'))
if i == 0:
W_user_list_2.append(tf.Variable(
tf.truncated_normal([user_attr_rank, layer_size[i]],
stddev=1/math.sqrt(float(layer_size[i])), mean=0), name='W_user_2'))
W_item_list_2.append(tf.Variable(
tf.truncated_normal([item_attr_rank, layer_size[i]],
stddev=1/math.sqrt(float(layer_size[i])), mean=0), name='W_item_2'))
user_middle = tf.matmul(user_attr_feature_2, W_user_list_2[i]) + b_user_list_2[i]
item_middle = tf.matmul(item_attr_feature_2, W_item_list_2[i]) + b_item_list_2[i]
else:
W_user_list_2.append(tf.Variable(
tf.truncated_normal([layer_size[i-1], layer_size[i]],
stddev=1/math.sqrt(float(layer_size[i])), mean=0), name='W_user_2'))
W_item_list_2.append(tf.Variable(
tf.truncated_normal([layer_size[i-1], layer_size[i]],
stddev=1/math.sqrt(float(layer_size[i])), mean=0), name='W_item_2'))
user_middle = tf.matmul(hiddens_user_2[i], W_user_list_2[i]) + b_user_list_2[i]
item_middle = tf.matmul(hiddens_item_2[i], W_item_list_2[i]) + b_item_list_2[i]
hiddens_user_2.append(tf.identity(user_middle, name='factor_user_2')) # identity ,sigmoid
hiddens_item_2.append(tf.identity(item_middle, name='factor_item_2'))
factor_user_2 = hiddens_user_2[layer_cnt]
factor_item_2 = hiddens_item_2[layer_cnt]
preds_1 = (tf.reduce_sum(tf.multiply(user_cf_feature_1, item_cf_feature_1), 1) +
tf.reduce_sum(tf.multiply(factor_user_1, factor_item_1), 1)) + mu_1
preds_2 = (tf.reduce_sum(tf.multiply(user_cf_feature_2, item_cf_feature_2), 1) +
tf.reduce_sum(tf.multiply(factor_user_2, factor_item_2), 1)) + mu_2
square_error = tf.sqrt(0.5*tf.reduce_mean(tf.squared_difference(preds_1, ratings_1)) +
0.5*tf.reduce_mean(tf.squared_difference(preds_2, ratings_2)))
loss = square_error
for i in range(layer_cnt):
loss = loss + lamb*(
tf.reduce_mean(tf.nn.l2_loss(W_user)) +
tf.reduce_mean(tf.nn.l2_loss(W_item_1)) +
tf.reduce_mean(tf.nn.l2_loss(W_item_2)) +
tf.reduce_mean(tf.nn.l2_loss(W_user_attr)) +
tf.reduce_mean(tf.nn.l2_loss(W_item_attr_1)) +
tf.reduce_mean(tf.nn.l2_loss(W_item_attr_2)) +
tf.reduce_mean(tf.nn.l2_loss(W_user_list_1[i])) +
tf.reduce_mean(tf.nn.l2_loss(W_item_list_1[i])) +
tf.reduce_mean(tf.nn.l2_loss(b_user_list_1[i])) +
tf.reduce_mean(tf.nn.l2_loss(b_item_list_1[i])) +
tf.reduce_mean(tf.nn.l2_loss(W_user_list_2[i])) +
tf.reduce_mean(tf.nn.l2_loss(W_item_list_2[i])) +
tf.reduce_mean(tf.nn.l2_loss(b_user_list_2[i])) +
tf.reduce_mean(tf.nn.l2_loss(b_item_list_2[i]))
)
tf.summary.scalar('square_error', square_error)
tf.summary.scalar('loss', loss)
merged_summary = tf.summary.merge_all()
train_step = tf.train.GradientDescentOptimizer(lr).minimize(loss)
return train_step, square_error, loss, merged_summary`
deepMF accu only reach 0.682 at around 1280 epoch, and then overfit
I try using deepFM.py with sparse data a8a.train, and its format likes "label index:value index:value..." .
I see in S1_4.txt, if some value is 0 it is also in the feature line, but in a8a.train it is not.
I run python deepFM.py, I got "Input to reshape is a tensor with 5528 values, but the requested shape requires a multiple of 672"
I don't know if the code not supports the format?
I am newbie to deep learning models. And i am not able to figure out how to predict using the saved model of your CCFNET on our dataset (which looks exactly the same as movielens). Can you please mention the code for the input, feed_dict and prediction in tensorflow.
Thanks
I'd like to evaluate the CCCFNet performance on movielens-1M, it would save me a lot of time if you could upload the data transfering tool. Thanks a lot!
hello, I don't find dropout param in the code
but the paper says dropout can lift the performance
is there any implementation of dropout in this project?
if params['is_use_dnn_part']:
w_fm_nn_input = tf.reshape(tf.gather(w_fm, _ind) * tf.expand_dims(_values, 1), [-1, field_cnt * dim])
print(w_fm_nn_input.shape)
这段代码实现了什么逻辑?
field_cnt和feature_cnt有什么差别?
谢谢!!
I could not find the dataset used for training and testing in DeepFM, such as 'data/part01.svmlight_balanced.csv' and 'data/part02.svmlight.csv'. Could you please tell me where I can find them? Thanks!
hello, I have run the code DeepMF, the result is "auc is 0.581294124784 , at epoch 115 , time is 0.0000 min , train_loss is 0.00"
the last two terms are always the same...
你好,我想问下 S1_4_and_S5.zip 里面数据的含义
0 1:0.000000 2:0.000000 3:0.000000 4:0.000000 5:0.000000 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000 11:0.000000 12:0.000000 13:0.000000 14:0.000000 15:0.000000 16:0.001348 17:0.000000 18:0.222222 19:0.000000 20:0.001282 21:0.000000 22:0.000000 23:0.000000 24:0.000000 25:0.000000 26:0.000000 27:0.000000 28:0.000000 29:0.000000 30:0.000000 31:0.000000 32:0.000000 33:0.000000 34:0.000000 35:0.000000 36:0.000000 37:0.000000 38:0.000000 39:0.000000 40:0.000000 41:0.000000 42:0.000000 43:0.017241 44:0.000000 45:0.000000 46:0.000000 #10,GX000-00-0000000
这样一条数据,代表的是什么意思呢? 第一个0 是是否点击? 那后面的这些特征代表的含义是什么啊,还有为什么后面的数是小数呢,代表的含义是什么呢? 如果以ml-1m电影数据为例,期待您的回答
How to preprocess the movielen_data to movielen_100k.pkl. The part of content is not very understanding.
Please, thank you!
In your ccfnet 91~92 lines
user_embeddings
= tf.nn.embedding_lookup_sparse(W_user_attr, user_sp_ids, user_sp_weights, name='user_embeddings', combiner='sum')
item_embeddings = tf.nn.embedding_lookup_sparse(W_item_attr, item_sp_ids, item_sp_weights, name='item_embeddings', combiner='sum')`
I can't understand the second parameter, user_sp_ids, which is the feature indices(I think). According to my understanding, you use those feature indices to choose rows from W_user_attr. So can you explain why did it ? Thank you!
I want an app that broadcasts video to a remote location in the background of giving me driving instructions so that I have insurance footage in old cars
I have run the deepFM about 400 times, and the AUC is around 0.68. How many iterations should I take to get the best result?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.