Skip to content

Latest commit

 

History

History

sentence_classifier

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Sentence Sentiment Classifier

This example builds sentence convolutional classifier, and trains on SST data. The example config config_kim.py corresponds to the paper (Kim) Convolutional Neural Networks for Sentence Classification.

The example shows:

  • Contruction of simple model, involving the Embedder and Conv1DClassifier.
  • Use of Texar MultiAlignedData to read parallel text and label data.

Usage

Use the following cmd to download and prepare the SST binary data:

python sst_data_preprocessor.py [--data_path ./data]

Here

  • --data_path specifies the directory to store the SST data. If the data files do not exist, the program will automatically download, extract, and pre-process the data.

The following cmd trains the model with Kim's config:

python clas_main.py --config config_kim

Here:

  • --config specifies the config file to use. E.g., the above use the configuration defined in config_kim.py

The model will begin training and evaluating on the validation data, and will evaluate on the test data after every epoch if a valid accuracy is obtained.

Results

The model achieves around 83% test set accuracy.