Skip to content

Use PyTorch to build an LSTM model for text classification on the IMDB dataset.

Notifications You must be signed in to change notification settings

ki-ljl/LSTM-IMDB-Classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LSTM-IMDB-Classification

Use PyTorch to build an LSTM model for text classification on the IMDB dataset.

Environment

pytorch==1.10.1+cu111

numpy==1.18.5

pandas==1.2.3

Usage

  1. Download the glove.6B.50d.txt file from kaggle.
  2. Generate vocabulary_vectors.npy and word_list.npy:
if __name__ == '__main__':
    load_cab_vector()
  1. Generate sentence_code_1.npy and sentence_code_2.npy:
if __name__ == '__main__':
    # load_cab_vector()
    process_sentence('train')
    process_sentence('test')
  1. Generate training and test sets:
if __name__ == '__main__':
    # load_cab_vector()
    # process_sentence('train')
    # process_sentence('test')
    process_batch(batch_size=100)
  1. Model training and testing:
if __name__ == '__main__':
    train()
    test()
    # load_cab_vector()
    # process_sentence('train')
    # process_sentence('test')
    # process_batch(100)

About

Use PyTorch to build an LSTM model for text classification on the IMDB dataset.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published