Code Monkey home page Code Monkey logo

gru4rec_tensorflow's People

Contributors

songweiping avatar songwp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gru4rec_tensorflow's Issues

负采样的操作

在model.py#L136中,注释写道:Use other examples of the minibatch as negative samples.
请问如何通过softmax和sampled_W,sampled_b进行负采样的呢?
水平有限,希望大佬不吝赐教~

关于训练中的loss问题

您好,我在运行这篇文章的代码时,训练的结果是这样的:当lr=0.000017 loss=1.4135(最小),随后当lr=0.000010(之后一直不变),随着step增大,loss也在逐渐增大。这种现象正常吗?或者怎么解释呢?我是这方面的小白,望多包涵。谢谢!

A question about evaluation during training step

@Songweiping 您好
很感谢您特地写了一个tensorflow版本的GRU4Rec,真的很浅显易懂
我在每次training step时,用本篇evaluation的方法查看traing时的recall变化
image
我发现每次recall都接近1
image

请问这样是正常的现象吗

TypeError: unhashable type: 'list'

Connected to pydev debugger (build 183.5153.39)
0.5
Traceback (most recent call last):
  File "/home/syh/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/183.5153.39/helpers/pydev/pydevd.py", line 1741, in <module>
    main()
  File "/home/syh/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/183.5153.39/helpers/pydev/pydevd.py", line 1735, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/home/syh/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/183.5153.39/helpers/pydev/pydevd.py", line 1135, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/run/media/syh/0D11080D0D11080D/workspace/Recommender-System/exp/GRU4Rec_TensorFlow-master/main.py", line 82, in <module>
    gru.fit(data)
  File "/run/media/syh/0D11080D0D11080D/workspace/Recommender-System/exp/GRU4Rec_TensorFlow-master/model.py", line 190, in fit
    offset_sessions = self.init(data)
  File "/run/media/syh/0D11080D0D11080D/workspace/Recommender-System/exp/GRU4Rec_TensorFlow-master/model.py", line 178, in init
    data.sort_index([self.session_key, self.time_key], inplace=True)
  File "/run/media/syh/0D11080D0D11080D/workspace/Recommender-System/exp/venv/lib/python2.7/site-packages/pandas/core/frame.py", line 2952, in sort_index
    axis = self._get_axis_number(axis)
  File "/run/media/syh/0D11080D0D11080D/workspace/Recommender-System/exp/venv/lib/python2.7/site-packages/pandas/core/generic.py", line 293, in _get_axis_number
    axis = self._AXIS_ALIASES.get(axis, axis)
TypeError: unhashable type: 'list'

Environment: Manjaro Python 2.7

data issue

data = pd.merge(data, pd.DataFrame({self.item_key:itemids, 'ItemIdx':self.itemidmap[itemids].values}), on=self.item_key, how='inner')
After merged with pd.DataFrame({self.item_key:itemids, 'ItemIdx':self.itemidmap[itemids].values}), the data 's order is based on itemidx order. So I think the code for processing data after is not true.

Requirements is incomplete

Could you explain used python libraries in detail in the Requirements or release a requirements.txt file ?

A question about the testing process.

Hello, Song,

I found a problem in this kind of process.
In your evaluation.py:
image
I note that you picked ">" here, but if we use tanh as the final activation function, many scores of this preds may be equal to 1 for each user. And that means many scores of items are in one position at the same time. But this trick is unreasonable, because we cannot rank these items. If you use >=, the performance will be bad.

I think this is the implement in the original Hidash's code. So what do you think of this?

Looking forward to your reply.
Thank you ~

Cannot save the model in .pkl file

Restore model from save/lstm_p0.7_rnn100_batch16_unfold8 successfully!
Traceback (most recent call last):
File "test.py", line 104, in
res = evaluate(args)
File "test.py", line 83, in evaluate
joblib.dump(model, joblib_file)
File "//anaconda3/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 502, in dump
NumpyPickler(f, protocol=protocol).dump(value)
File "//anaconda3/lib/python3.7/pickle.py", line 437, in dump
self.save(obj)
File "//anaconda3/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 292, in save
return Pickler.save(self, obj)
File "//anaconda3/lib/python3.7/pickle.py", line 549, in save
self.save_reduce(obj=obj, *rv)
File "//anaconda3/lib/python3.7/pickle.py", line 662, in save_reduce
save(state)
File "//anaconda3/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 292, in save
return Pickler.save(self, obj)
File "//anaconda3/lib/python3.7/pickle.py", line 504, in save
f(self, obj) # Call unbound method with explicit self
File "//anaconda3/lib/python3.7/pickle.py", line 856, in save_dict
self._batch_setitems(obj.items())
File "//anaconda3/lib/python3.7/pickle.py", line 882, in _batch_setitems
save(v)
File "//anaconda3/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 292, in save
return Pickler.save(self, obj)
File "//anaconda3/lib/python3.7/pickle.py", line 549, in save
self.save_reduce(obj=obj, *rv)
File "//anaconda3/lib/python3.7/pickle.py", line 662, in save_reduce
save(state)
File "//anaconda3/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 292, in save
return Pickler.save(self, obj)
File "//anaconda3/lib/python3.7/pickle.py", line 504, in save
f(self, obj) # Call unbound method with explicit self
File "//anaconda3/lib/python3.7/pickle.py", line 856, in save_dict
self._batch_setitems(obj.items())
File "//anaconda3/lib/python3.7/pickle.py", line 882, in _batch_setitems
save(v)
File "//anaconda3/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 292, in save
return Pickler.save(self, obj)
File "//anaconda3/lib/python3.7/pickle.py", line 549, in save
self.save_reduce(obj=obj, *rv)
File "//anaconda3/lib/python3.7/pickle.py", line 662, in save_reduce
save(state)
File "//anaconda3/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 292, in save
return Pickler.save(self, obj)
File "//anaconda3/lib/python3.7/pickle.py", line 504, in save
f(self, obj) # Call unbound method with explicit self
File "//anaconda3/lib/python3.7/pickle.py", line 856, in save_dict
self._batch_setitems(obj.items())
File "//anaconda3/lib/python3.7/pickle.py", line 882, in _batch_setitems
save(v)
File "//anaconda3/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 292, in save
return Pickler.save(self, obj)
File "//anaconda3/lib/python3.7/pickle.py", line 549, in save
self.save_reduce(obj=obj, *rv)
File "//anaconda3/lib/python3.7/pickle.py", line 662, in save_reduce
save(state)
File "//anaconda3/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 292, in save
return Pickler.save(self, obj)
File "//anaconda3/lib/python3.7/pickle.py", line 504, in save
f(self, obj) # Call unbound method with explicit self
File "//anaconda3/lib/python3.7/pickle.py", line 856, in save_dict
self._batch_setitems(obj.items())
File "//anaconda3/lib/python3.7/pickle.py", line 882, in _batch_setitems
save(v)
File "//anaconda3/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 292, in save
return Pickler.save(self, obj)
File "//anaconda3/lib/python3.7/pickle.py", line 524, in save
rv = reduce(self.proto)
TypeError: can't pickle _thread.RLock objects

关于验证集的使用

请问,代码中为什么没有使用验证集(从训练集中划分出来的验证集)来设置模型训练过程的early stop?貌似代码中的验证过程用的是test数据集 。 @Songweiping

A question about the column:Session_ID

hello Dr.Song,my question is about the session_id.
Should different user share the same session_id?
let's say if user_a have 5 sessions which has session_id in 0-4,and user_b also have 5 sessions, the session_id of user_b should also be 0-4 or should them be 5-9?
thx
looking forward to your reply

MultiRNNCell build

stacked_cell = rnn_cell.MultiRNNCell([drop_cell] * self.layers)

When constructing a MultiRNNCell with this statement, tensorflow will prompt that multiple cells are actually sharing weights.
So I think the correct build method should look like this:

            cells = []
            for i in range(self.layers):
                cell = rnn_cell.GRUCell(num_units=self.rnn_size, activation=self.hidden_act)
                cell = rnn_cell.DropoutWrapper(cell, output_keep_prob=self.dropout_p_hidden)
                cells.append(cell)
            multi_cell = rnn_cell.MultiRNNCell(cells)

cross_entropy只计算了正例?

hi,
请问,在 GRU4Rec.cross_entrop 函数(line 98)中,tf.diag_part 只提取了对角线上的元素,这样是否会导致loss function只计算了正例的loss, 而没有计算负例的loss?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.