Skip to content

About

IMDB Sentiment Analysis with TextGCN (Semi-Supervised)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

IMDB Sentiment Analysis with TextGCN (Semi-Supervised)

This repository contains a Jupyter Notebook implementation of Text Graph Convolutional Networks (TextGCN) for semi-supervised sentiment analysis on the IMDB movie review dataset.

📌 Overview

TextGCN builds a single heterogeneous graph containing both document nodes and word nodes. Edges between document and word nodes are weighted by TF-IDF, while edges between word nodes are weighted by Positive Pointwise Mutual Information (PMI). A two-layer Graph Convolutional Network (GCN) is then trained on this graph to classify document nodes.

Key features:

  • Semi-supervised learning: Only 10% of the data (5,000 labeled reviews) is used for training; the remaining 90% (45,000 reviews) are treated as unlabeled/test data.
  • Efficient graph construction: PMI computation leverages sparse matrix operations (no explicit loops over word pairs).
  • Achieved test accuracy: 73.92% on the full IMDB test set.

📊 Dataset

  • IMDB Dataset (IMDB Dataset.csv): 50,000 highly polar movie reviews (25,000 positive, 25,000 negative).
  • Source: IMDB Dataset of 50K Movie Reviews on Kaggle
  • The dataset is split into:
    • Training (labeled): 5,000 reviews (10%)
    • Test (unlabeled + evaluation): 45,000 reviews (90%)
  • Stratified split ensures class balance.

Model Architecture

  • Graph nodes: 50,000 document nodes + 10,000 word nodes (vocabulary size = 10,000)
  • Graph edges:
    • Document–Word: TF-IDF weight
    • Word–Word: PMI weight (only positive PMI values kept)
  • GCN layers:
    • Input → Hidden (200 units) with ReLU + Dropout (0.5)
    • Hidden → Output (2 classes) with no activation (CrossEntropyLoss)
  • Optimizer: Adam (lr=0.005, weight decay=1e-4)
  • Epochs: 150

Results

After 150 epochs, the model achieves:

  • Best Test Accuracy 73.92%
  • Training Accuracy (labeled set) ~99.8% (overfitting on small labeled set is expected)

Reference

  • Original TextGCN paper: Graph Convolutional Networks for Text Classification (Yao et al., AAAI 2019)

About

IMDB Sentiment Analysis with TextGCN (Semi-Supervised)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages