🎬 Finetuned BERT for Sentiment Analysis

This model is a fine-tuned version of BERT (bert-base-uncased) for binary sentiment classification (positive vs negative).

It is trained on the IMDb movie reviews dataset, a widely used benchmark for sentiment analysis tasks.


πŸš€ Model Performance

Metric Score
Accuracy 92.25%
F1 Score 92.38%
Precision 90.86%
Recall 93.95%

Confusion Matrix Insights

  • Strong balance between positive and negative predictions
  • Slight tendency toward higher recall (fewer false negatives)
  • Overall robust generalization on full test dataset (25,000 samples)

πŸ“Œ Model Description

This project demonstrates fine-tuning of a pre-trained Transformer model for NLP classification tasks using the Hugging Face ecosystem.

Key features:

  • Pretrained BERT encoder
  • Fine-tuned for binary sentiment classification
  • Implemented using Hugging Face Transformers Trainer API
  • Evaluated using standard classification metrics

πŸ“Š Dataset

  • Name: IMDb Movie Reviews Dataset
  • Size:
    • Train: 25,000 samples
    • Test: 25,000 samples
  • Classes:
    • 0 β†’ Negative
    • 1 β†’ Positive

The dataset is balanced across both classes.


πŸ‹οΈ Training Procedure

Hyperparameters

  • Learning rate: 2e-5
  • Batch size: 8
  • Epochs: 2
  • Optimizer: AdamW
  • Scheduler: Linear decay
  • Mixed precision: Enabled (FP16)

Training Details

  • Framework: Hugging Face Trainer
  • Hardware: Google Colab GPU
  • Loss function: Cross-entropy

🧠 Intended Use

This model can be used for:

  • Sentiment analysis on movie reviews
  • Product review classification
  • Social media sentiment detection
  • NLP learning and experimentation

⚠️ Limitations

  • Trained only on English text
  • Domain-specific (movie reviews) β†’ may not generalize perfectly to other domains
  • Binary classification only (no neutral sentiment)
  • May inherit biases present in training data

πŸ› οΈ How to Use

from transformers import pipeline

classifier = pipeline("sentiment-analysis", model="ashwini10521/finetuned_bert")

result = classifier("This movie was absolutely amazing!")
print(result)
Downloads last month
11
Safetensors
Model size
0.1B params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for ashwini10521/finetuned_bert

Finetuned
(6857)
this model

Evaluation results