Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The historical behavior length problem #35

Open
wytzzz opened this issue Apr 17, 2020 · 0 comments
Open

The historical behavior length problem #35

wytzzz opened this issue Apr 17, 2020 · 0 comments

Comments

@wytzzz
Copy link

wytzzz commented Apr 17, 2020

  • 问题描述:
    在用其他数据集训练DIEN时,当样本历史行为长度<=1时,训练阶段报错.
  • 问题分析:
    在auxiliary_losss函数中,将GRU的输出h_states(h(t)分别与嵌入向量click_seq(e(t+1)),noclick_seq(e'(t+1))进行concat作为auxiliary_net的输入. 调用auxiliary_losss的传入参数如下:
    aux_loss_1 = self.auxiliary_loss(rnn_outputs[:, :-1, :], self.item_his_eb[:, 1:, :], self.noclk_item_his_eb[:, 1:, :], self.mask[:, 1:], stag="gru")
    rnn_outputs的第2个维度取[:-1],item_his_eb和noclk_item_his_eb的第二个维度取[1:]这样做为了将h(t)和e(t+1),e'(t+1)方便的concat在一起.但是这里假设了所有输入样本的历史行为长度>=2.如果历史行为长度<2,则[1:]取到的切片为空,导致后面的reshape报错.
  • 问题解决:
    作者在DataIterator的初始化参数中提供了minlen=None参数,只需要将该参数设置为1即可.
    if self.minlen != None: if len(mid_list) <= self.minlen: continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant