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

Chapter_3_LogisticRegression_block15 #35

Open
bgbofficial opened this issue Jul 4, 2019 · 1 comment
Open

Chapter_3_LogisticRegression_block15 #35

bgbofficial opened this issue Jul 4, 2019 · 1 comment

Comments

@bgbofficial
Copy link

change:

acc = (mask == y_data).sum().data[0] / y_data.shape[0]
if (e + 1) % 200 == 0:
print('epoch: {}, Loss: {:.5f}, Acc: {:.5f}'.format(e+1, loss.data[0], acc))
)

to

acc = (mask == y_data).sum().numpy() / y_data.size()[0]
if (e + 1) % 200 == 0:
print('epoch: {}, Loss: {:.5f}, Acc: {:.5f}'.format(e+1, loss.detach().numpy(), acc)

@DrBugKiller
Copy link

change:

acc = (mask == y_data).sum().data[0] / y_data.shape[0]
if (e + 1) % 200 == 0:
print('epoch: {}, Loss: {:.5f}, Acc: {:.5f}'.format(e+1, loss.data[0], acc))
)

to

acc = (mask == y_data).sum().numpy() / y_data.size()[0]
if (e + 1) % 200 == 0:
print('epoch: {}, Loss: {:.5f}, Acc: {:.5f}'.format(e+1, loss.detach().numpy(), acc)

Thanks!

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