Datasets:
datasets:
- sentiment-analysis-dataset-oversampled
language:
- en
task_categories:
- text-classification
task_ids:
- sentiment-classification
tags:
- sentiment-analysis
- text-classification
- balanced-dataset
- oversampling
- csv
pretty_name: Sentiment Analysis Dataset OverSampled
dataset_info:
features:
- name: text
dtype: string
- name: label
dtype: int64
splits:
- name: train
num_examples: 121374
- name: validation
num_examples: 10499
- name: test
num_examples: 10499
format: csv
Sentiment Analysis Dataset
Overview
This dataset is designed for sentiment analysis tasks, offering a balanced and pre-processed collection of labeled text data. The dataset includes three sentiment labels:
- 0: Negative
- 1: Neutral
- 2: Positive
The training dataset has been oversampled to ensure balanced label distribution, making it suitable for training robust sentiment analysis models. The validation and test datasets remain unaltered to preserve the original label distribution for unbiased evaluation.
Dataset Details
Structure
Split | Rows | Label Distribution |
---|---|---|
Train | 121,374 | Balanced (Oversampled) |
Validation | 10,499 | Original |
Test | 10,499 | Original |
File Format
- Type: CSV
- Columns:
text
: The input text.label
: The sentiment label (0
,1
,2
).
Labels
Label | Sentiment |
---|---|
0 |
Negative |
1 |
Neutral |
2 |
Positive |
Preprocessing
The dataset has been thoroughly cleaned and pre-processed, ensuring consistency and readiness for use in machine learning tasks. Preprocessing steps include:
- Removal of dubplicates.
- Removal of Null rows.
- Filtering out extremely short or long entries.
Usage
Loading the Dataset
The dataset can be loaded and processed using common Python libraries like pandas
:
import pandas as pd
# Load the train dataset
train_data = pd.read_csv("path/to/train.csv")
val_data = pd.read_csv("path/to/validation.csv")
test_data = pd.read_csv("path/to/test.csv")
# Display sample data
print(train_data.head())
Example
# Example usage: Distribution of labels in the train dataset
print(train_data['label'].value_counts())
# Example data preprocessing for modeling
from sklearn.model_selection import train_test_split
X_train, y_train = train_data['text'], train_data['label']
X_val, y_val = val_data['text'], val_data['label']
X_test, y_test = test_data['text'], test_data['label']
Applications
This dataset can be used for various sentiment analysis tasks, including:
- Building sentiment classifiers for social media analysis.
- Evaluating product or service feedback.
- Developing opinion mining systems.
Dataset Split
Split | Purpose |
---|---|
Train | For model training (oversampled). |
Validation | For hyperparameter tuning. |
Test | For final model evaluation. |
Citation
If you use this dataset in your research or projects, please provide proper attribution:
Sentiment Analysis Dataset (OverSampled)
Contributed by: Syed Khalid Hussain
Author: Syed Khalid Hussain