Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Title: WHAT DID YOU SAY?!

Team Members: Nathan Kotlyn, Taylor Montroy

Competition: Natural Language Processing with Disaster Tweets

Project Link: https://www.kaggle.com/c/nlp-getting-started/overview

Introduction

Project Summary

The use of social media, specifically Twitter, has increasingly become widespread across the globe. Users hundreds of miles apart are connected to eachother, allowing for instant communication. In times of emergency, tweets/posts can be used to spread awareness and communicate the events taking place. With that, organizations are shifting their focuses to programmatically monitoring these sites. However, often times these posts can be ambiguous and it is difficult to interpret whether or not they are comminucating a real emergency.


Project Objective

Our objective is to use text mining (regualr expressions and topic modeling) to build a Neural Net Classifier, Logistic Regression, and a Support Vector Machine. We will pre-process the data, build a term document matrix, and run it through our classifiers.


Data Summary

The data is 10,000 observations which include tweet information, such as: tweet id, tweet text, location, tweet keyword, and a target variable (a '0' or '1' and only included in train dataset).

train.csv (file)

  • id - a unique identifier for each tweet
  • text - the text of the tweet
  • location - the location the tweet was sent from (may be blank)
  • keyword - a particular keyword from the tweet (may be blank)
  • target - in train.csv only, this denotes whether a tweet is about a real disaster (1) or not (0)

train.csv (file)

  • id - a unique identifier for each tweet
  • text - the text of the tweet
  • location - the location the tweet was sent from (may be blank)
  • keyword - a particular keyword from the tweet (may be blank)

Exploratory Analysis Stage (EDA)

Visualizations

TOP 5 KEY WORDS CLASSIFICATION DISTRIBUTION

image

DISASTER TWEET CLASSIFICATION WORD CLOUD

image

Non DISASTER CLASSIFICATION WORD CLOUD

image

TOP 5 KEY WORDS CLASSIFICATION DISTRIBUTION

LOCATIONS

Interesting Findings

Distribution of Classification Labels:

In the training dataset, we can see that there is a somewhat fair distribution of the target labels (i.e., classification of tweets). There are about 4300 tweets classified as 'non-distaster' and about 3200 tweets classified as 'disaster.' This distribution of training set labels shows that we can use the dataset for building out model(s) as it isn't heavily skewed.

Findings on Locations:

We can also see that the location of the tweet does not matter to use. There is a mixture of both cities, states, and nations in the location column. For example, some tweets are located in 'USA' while others are more specifically labelled in 'Los Angeles, CA.' Also, there is the duplication of country names like 'USA' and 'United States.'

Findings on Keywords:

Looking at the distribution of the keywords, we find that some words such as armageddon, siren, harm, and fear are more commonly found in the tweets classified as 'non-distaster.' This could be considered opposite of what we think we should find.

With our basic exploratory findings, it is clear that we should not use location or keyword in our models. They provide no-real indication on whether a tweet would be classified as a disaster or not. Thinking ahead, we are planning to use a document term matrix in our models to quantify contextually valuable terms int the dataset, so the keywords and locations variables would be of no use to the analysis.

Data Cleaning Stage

Labels were addeed to training and testing sets first so that we can split them back up prior to modeling to ensure the feature space of the term document matrix was the same size between the training and testing sets.

The location and keyword columns were dropped since they have no use to the analysis.

Regular expressions were used to remove to special characters, numbers, and punctuationthese provide no contextual wieght in classyfying a tweet is realted to a disaster.

Hyperlinks and usernames were also removed as they also provide no contexutal value to predicting a disaster.

Following, words that provide little to no value by themselves were removed, such as conjunctions of 'of', 'or', and 'not'. In addition, we reduced each work to its stem since a word can be in a tense, yet represent the same concept.

Once the data, was cleaned the TfidfVectorizer function from the Sci-Kit learn library was used to generate the term document matrix. Which generated a feature space of 2985 different possible terms.

Modeling Stage

The data was then re-split into prior training and testing sets and passed into three different Machine Learing algorithms to find which one would be the best in classfying disaster related tweets.

About

Machine Learning project using twitter data to predict disasters

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages