v2.5.0
Datasets ⭐
EXAMPLE CODE
Sentiment-140 Dataset
Load the Sentiment-140 dataset to automatically classify the sentiment of Twitter messages in Python with one line of code in seconds and plug it in TensorFlow and PyTorch with Activeloop Hub.

Sentiment-140 Dataset

What is Sentiment-140 Dataset?

Sentiment-140 dataset has 800,000 tweets with positive emoticons, and 800,000 tweets with negative emoticons, for a total of 1,600,000 training tweets as well as a test set of 177 negative tweets and 182 positive tweets with only some data containing emoticons. This dataset is useful for consumers or companies to automatically classify the sentiment of their brands, product, or topic on Twitter as either positive or negative with respect to a query term. The dataset has only tweets in English.

Download Sentiment-140 Dataset in Python

Instead of downloading the Sentiment-140 dataset in Python, you can effortlessly load it in Python via our open-source package Hub with just one line of code.

Load Sentiment-140 Dataset Training Subset in Python

1
import hub
2
ds = hub.load("hub://activeloop/sentiment-140-train")
Copied!

Load Sentiment-140 Dataset Testing Subset in Python

1
import hub
2
ds = hub.load("hub://activeloop/sentiment-140-test")
Copied!

Sentiment-140 Dataset Structure

Sentiment-140 Data Fields

For the test set:
  • sentiment_type: tensor containing the polarity of the tweet. 0 represents negative, 2 represents neutral and 4 represents a positive tweet.
  • tweet_text: the tensor containing the tweeted text.
  • user: the tensor containing the details of the user who tweeted the text.
  • id: tensor containing the id of the tweet.
  • date: tensor containing the date of the tweet.
  • topic: tensor containing the topic of the tweet.
For the train set:
  • sentiment_type: tensor containing the polarity of the tweet. 0 represents negative, 2 represents neutral and 4 represents a positive tweet.
  • tweet_text: tensor containing the tweeted text.
  • user: tensor containing the details of the user who tweeted the text.
  • query_flag: tensor containing query term, if there is no query, then the value will be NO_QUERY.
  • date: tensor containing the date of the tweet.
  • id: tensor containing the id of the tweet.

Sentiment-140 Data Splits

  • The Sentiment-140 dataset has 800,000 tweets with positive emoticons, and 800,000 tweets with negative emoticons, for a total of 1,600,000 training tweets.
  • The Sentiment-140 dataset test set was composed of 177 negative tweets and 182 positive tweets with only some data containing emoticons.

How to use Sentiment-140 Dataset with PyTorch and TensorFlow in Python

Train a model on Sentiment-140 dataset with PyTorch in Python

Let's use Hub's built-in PyTorch one-line dataloader to connect the data to the compute:
1
dataloader = ds.pytorch(num_workers=0, batch_size=4, shuffle=False)
Copied!

Train a model on Sentiment-140 dataset with TensorFlow in Python

1
dataloader = ds.tensorflow()
Copied!

Sentiment-140 Dataset Creation

Data Collection and Normalization Information
The training data was post-processed. Emoticons are removed for training purposes. All tweets containing both positive and negative emoticons are filtered out and removed. Retweets or tweets copied from another user have been removed. Tweets containing ":P" are removed. The retweet or repeated tweets are removed from the dataset. The test data was manually collected using web applications.

Additional Information about Sentiment-140 Dataset

Sentiment-140 Dataset Description

Sentiment-140 Dataset Curators

Alec Go, Richa Bhayani, and Lei Huang

Sentiment-140 Dataset Licensing Information

Hub users may have access to a variety of publicly available datasets. We do not host or distribute these datasets, vouch for their quality or fairness, or claim that you have a license to use the datasets. It is your responsibility to determine whether you have permission to use the datasets under their license. If you're a dataset owner and do not want your dataset to be included in this library, please get in touch through a GitHub issue. Thank you for your contribution to the ML community!

Sentiment-140 Dataset Citation Information

1
@article{go2009twitter,
2
title={Twitter sentiment classification using distant supervision},
3
author={Go, Alec and Bhayani, Richa and Huang, Lei},
4
journal={CS224N project report, Stanford},
5
volume={1},
6
number={12},
7
pages={2009},
8
year={2009}
9
}
Copied!