mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

keras imdb data set is not converged when maximum size of the word sequence is 500

Open ericvlognow opened this issue 8 years ago • 4 comments

i am trying to use mxnet to analyze the keras imdb dataset. using attached python script (imdb_mx2.py), it works well when maximum size of the word sequence is 150, once i increased the length to 500, it does not converge anymore. imdb_mx2.py.txt

ericvlognow avatar Mar 11 '18 20:03 ericvlognow

following are outputs when maxLen = 150 dyld: warning, LC_RPATH ${ORIGIN} in /Library/Python/2.7/site-packages/mxnet/libmxnet.so being ignored in restricted program because it is a relative path Preparing train set... Preparing test set... Trimming to 5000 max-features Padding to length 150 Epoch 0, Training ('accuracy', 0.6598865089514067) Epoch 1, Training ('accuracy', 0.8490249360613811) Epoch 2, Training ('accuracy', 0.8255274936061381) ('Accuracy: ', 0.83776)

ericvlognow avatar Mar 11 '18 20:03 ericvlognow

following are outputs when maxLen = 500 dyld: warning, LC_RPATH ${ORIGIN} in /Library/Python/2.7/site-packages/mxnet/libmxnet.so being ignored in restricted program because it is a relative path Preparing train set... Preparing test set... Trimming to 5000 max-features Padding to length 500 Epoch 0, Training ('accuracy', 0.5082320971867008) Epoch 1, Training ('accuracy', 0.523497442455243) Epoch 2, Training ('accuracy', 0.5347266624040921) ('Accuracy: ', 0.5114)

ericvlognow avatar Mar 11 '18 20:03 ericvlognow

i tried it in keras with tensor_flow back end, even with max_len = 500, it generated decent result

ericvlognow avatar Mar 11 '18 20:03 ericvlognow

i found the issue. the pre-padding instead of post-padding solved the issue.

dyld: warning, LC_RPATH ${ORIGIN} in /Library/Python/2.7/site-packages/mxnet/libmxnet.so being ignored in restricted program because it is a relative path Preparing train set... Preparing test set... Trimming to 5000 max-features Padding to length 500 Epoch 0, Training ('accuracy', 0.7589114450127877) Epoch 1, Training ('accuracy', 0.8890664961636828) Epoch 2, Training ('accuracy', 0.9126838235294118) Epoch 3, Training ('accuracy', 0.9197969948849105) ('Accuracy: ', 0.81308)

ericvlognow avatar Mar 12 '18 06:03 ericvlognow