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

3.13节,train_ch3,params更新 #50

Open
aesdhj opened this issue May 21, 2020 · 1 comment
Open

3.13节,train_ch3,params更新 #50

aesdhj opened this issue May 21, 2020 · 1 comment
Assignees

Comments

@aesdhj
Copy link

aesdhj commented May 21, 2020

        if trainer is None:

            sample_grads = grads
            params[0].assign_sub(grads[0] * lr)
            params[1].assign_sub(grads[1] * lr)

为什么params只更新0,1,不应该是
for (i,param) in enumerate(params):
params[i].assign_sub(grads[i]*lr)

@kpol-lgx
Copy link
Contributor

这个模型太复杂了,加上 params[2] 和 params[3] 后准确率没有显著提高,加入params[4] 和 params[5] 后准确率反而下降了。

  1. params[i], i = 0, 1
epoch 1, loss 0.0360, train acc 0.538, test acc 0.627
epoch 2, loss 0.0273, train acc 0.612, test acc 0.629
epoch 3, loss 0.0257, train acc 0.625, test acc 0.649
epoch 4, loss 0.0238, train acc 0.671, test acc 0.722
epoch 5, loss 0.0216, train acc 0.711, test acc 0.739
  1. params[i], i = 0, 1, 2, 3
epoch 1, loss 0.0250, train acc 0.644, test acc 0.744
epoch 2, loss 0.0152, train acc 0.773, test acc 0.790
epoch 3, loss 0.0139, train acc 0.789, test acc 0.785
epoch 4, loss 0.0133, train acc 0.797, test acc 0.796
epoch 5, loss 0.0129, train acc 0.801, test acc 0.796
  1. params[i], i = 0, 1, 2, 3, 4, 5
epoch 1, loss 0.0421, train acc 0.332, test acc 0.468
epoch 2, loss 0.0367, train acc 0.419, test acc 0.425
epoch 3, loss 0.0346, train acc 0.453, test acc 0.472
epoch 4, loss 0.0342, train acc 0.458, test acc 0.467
epoch 5, loss 0.0341, train acc 0.460, test acc 0.469

第三个下降可能是因为最后没有使用 dropout 。

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

3 participants