DSWE-GRNN: Multi-class Review Rating Classification

This model reproduces the DSWE-GRNN (Domain-Specific Word Embeddings with Gated Recurrent Neural Network) architecture from the paper:

"Multi-class Review Rating Classification using Deep Recurrent Neural Network"
Junaid Hassan, Umar Shoaib
Neural Computing and Applications (Springer), 2019
DOI: 10.1007/s11063-019-10125-6

Architecture

  • Embedding Layer: Domain-specific CBOW word embeddings (32-dimensional), trained on the corpus vocabulary
  • GRU Layers: 2 stacked GRU layers with 14 hidden units
  • Dropout: 0.15 (85% retention)
  • Output: Dense layer with softmax for multi-class classification
  • Optimizer: Adam
  • Loss: Cross-entropy with class weighting for imbalance handling

Datasets

Hotel Reviews

  • Source: TripAdvisor hotel reviews (jniimi/tripadvisor-review-rating)
  • Classes: 5 (1–5 star ratings)
  • Samples: 14,895 total, 5,000 used for fast experimentation
  • Preprocessing: Lowercasing, punctuation removal, word tokenization

IMDB (planned)

  • Classes: 10 (1–10 scale)
  • Samples: 50,000

Results

Our Implementation (Hotel Reviews, 5K subset)

Metric Value
Accuracy 0.629
F1 (weighted) 0.618
F1 (macro) 0.518

Paper Baselines (Hotel Reviews)

Method Accuracy
WE-SimpleNN 0.8024
CNN 0.7877
LSTM 0.8092
CNN-LSTM 0.7843
DSWE-GRNN (paper) 0.8132

Gap Analysis

Our reproduction achieves 62.9% accuracy on a 5K subset vs the paper's 81.32% on the full 14,895 samples. Key factors:

  1. Dataset size: 5,000 vs 14,895 samples
  2. Downsampling strategy: Paper used class balancing; our best results use class-weighted loss on imbalanced data
  3. Training epochs: CPU constraints limited experiments
  4. Sequence length: max_len=128-200 vs paper's full review lengths

Usage

import torch
from dswe_grnn import DSWE_GRNN, TextPreprocessor, Vocabulary

# Load model checkpoint
checkpoint = torch.load("dswe_grnn_hotel_5k.pt")
model = DSWE_GRNN(
    vocab_size=10489,
    embedding_dim=32,
    hidden_dim=64,
    num_classes=5,
    num_layers=2,
    dropout=0.2
)
model.load_state_dict(checkpoint)
model.eval()

# Preprocess text
preprocessor = TextPreprocessor()
tokens = preprocessor.preprocess("Great hotel, amazing service and beautiful rooms!")

Files

  • dswe_grnn.py β€” Core model implementation
  • run_experiment.py β€” Training script
  • results_hotel_5k.json β€” Evaluation metrics
  • dswe_grnn_hotel_5k.pt β€” Model weights

Citation

@article{hassan2019multicl ass,
  title={Multi-class Review Rating Classification using Deep Recurrent Neural Network},
  author={Hassan, Junaid and Shoaib, Umar},
  journal={Neural Computing and Applications},
  year={2019},
  publisher={Springer},
  doi={10.1007/s11063-019-10125-6}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support