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

Problem with Label Encoding #12

Open
anandh51295 opened this issue Aug 4, 2020 · 2 comments
Open

Problem with Label Encoding #12

anandh51295 opened this issue Aug 4, 2020 · 2 comments

Comments

@anandh51295
Copy link

anandh51295 commented Aug 4, 2020

Thanks for this work i read you article on the nano nets site.
but i have this one doubt:
def onehot(idx, num_classes):
"""
1-hot encoding.
"""
encoding = np.zeros(num_classes)
encoding[1] = 1
return encoding

here you only set 1 to 1 position that only we got 1.0 accuracy but we need to set 1 based on the idx then we only get accuracy around 0.60. there is any way to improve the accuracy of the model

@adriansarno
Copy link
Contributor

Thank you for your ticket Anand, I will address the first problem (onehot) in my next pull request.
The second problem (improve model accuracy) I will try to address in a future PR.
The validation accuracy (val_acc) with the fixed onehot is 0.86, so it is still reasonable. Please see last lines of the training log, pasted below:

Epoch: 0061 train_loss= 0.03845 train_acc= 0.86364 val_loss= 0.03895 val_acc= 0.85620 time= 0.61268 Validation cost is not improving. Early stopping... Optimization Finished! Test set results: cost= 0.03870 accuracy= 0.85879 time= 0.37214

adriansarno pushed a commit that referenced this issue Dec 4, 2020
@MotiBaadror
Copy link

Accuracy is calculating np.argmax(labels) which will give all values as [1,1,1,1,...] . Since we have encoded labels [[0,,4,0,0,0,],[0,3,0,0,0] ...]. So the model is learning to get higher probability for the first position. When I test the model np.argmax(pred[test_mask],1) will give 1000+ values as 1 and some rest are zerop out of 1200+.

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