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

Vocabulary size #183

Open
lubiluk opened this issue Jun 12, 2019 · 0 comments
Open

Vocabulary size #183

lubiluk opened this issue Jun 12, 2019 · 0 comments

Comments

@lubiluk
Copy link

lubiluk commented Jun 12, 2019

Hi, while I was working with your code (I've rewritten it in Keras) I noticed one small detail about vocab_size:

vocab_size=len(vocab_processor.vocabulary_),

vocab_size=len(vocab_processor.vocabulary_),

Since we are padding sentences with zeros aren't we supposed to add padding word (0) into the vocabulary size? I think the original code from Yoon Kim does that:

W = np.zeros(shape=(vocab_size+1, k), dtype='float32')     

https://github.com/yoonkim/CNN_sentence/blob/23e0e1f7355705bb083043fda05c031b15acb38c/process_data.py#L55

I know, it's probably a minor thing but wanted to ask to be 100% sure whether we should or should not add one to the vocabulary size.

PS. You can find my code here, I tried to follow your solution as closely as possible. But despite reaching similar accuracy as your code, the training doesn't behave so nicely like yours does (yet...?).
https://github.com/lubiluk/cnn-sentence/blob/master/cnn_sentence.ipynb

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