Project for CSE 256 2026 winter project 1.
This project implements several sentiment classification models, including:
- Bag-of-Words (BOW) models
- Deep Averaging Network (DAN) with word-level embeddings
- Subword-based DAN using Byte Pair Encoding (BPE) All models can be trained and evaluated using a single command.
Python 3, PyTorch, scikit-learn, matplotlib
- Train and evaluate BOW models
python main.py --model BOW
- Train and evaluate word-level DAN
python main.py --model DAN
This runs the Deep Averaging Network (DAN) using: i. GloVe-initialized word embeddings ii. Randomly initialized word embeddings Both settings are trained and evaluated sequentially.
- Train and evaluate subword-based DAN (BPE)
python main.py --model SUBWORDDAN
Optional arguements for BPE:
python main.py --model SUBWORDDAN --bpe_vocab_size 10000 --subword_emb_dim 50
Arguments: --bpe_vocab_size: vocabulary size for BPE (default: 10000) --subword_emb_dim: embedding dimension for subword embeddings (default: 50)
-
Word-level DAN uses pre-trained GloVe embeddings when available.
-
Subword-based DAN initializes embeddings randomly and trains them from scratch.
-
All experiments are run for 100 epochs.