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

有几处代码问题需要咨询您 #7

Open
springbarley opened this issue Jun 16, 2016 · 1 comment
Open

有几处代码问题需要咨询您 #7

springbarley opened this issue Jun 16, 2016 · 1 comment

Comments

@springbarley
Copy link

拜读了您的文章,非常有收获,但仔细阅读了代码后发觉几处不理解的地方,在此向您讨教。
以下SGD update部分的函数
//relation
relation_tmp[rel_a][i] += rate_c_posErrorVec[tid][i];
//head
nonLinear_2 = 1-cnn_vec[e1_a][i]_cnn_vec[e1_a][i];
cnn_grad[e1_a][i] += rate_c_posErrorVec[tid][i]_nonLinear_2;
//tail
nonLinear_2 = 1-cnn_vec[e2_a][i]_cnn_vec[e2_a][i];
cnn_grad[e2_a][i] -= rate_c_posErrorVec[tid][i]_nonLinear_2;
//relation
relation_tmp[rel_b][i] -= rate_c_negErrorVec[tid][i];

问题1:nonLinear_2是对CNN神经元的激活函数求导的变量么?
问题2:这一部分代码是否是计算cost = |t1 - r1 - h1| - |t2 - r2 -h2|的偏导数?代码部分 entity_vec[e2][ii]-cnn_vec[e1][ii]-relation_vec[rel][ii]是|tail - relation - head|,而文章中是|head + relation -tail|?

@xrb92
Copy link
Owner

xrb92 commented Jun 16, 2016

您好:
问题1:是对tanh的求导;
问题2:是在不符合margin下计算cost的偏导,由于有正负例所以梯度更新方向会相反。

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

2 participants