Giter Club home page Giter Club logo

twitter-sentiment-analysis's Introduction

Twitter Sentiment Analysis

image

Requirements :-

There are some general library requirements for the project and some which are specific to individual methods. The general requirements are as follows. ● Numpy, Pandas

● scikit-learn

● scipy

● nltk

The library requirements specific to some methods are:

● Multinomial Naive Bayes

● SVM

● Logistic Regression

● xgboost for XGBoost

● Linear SVC

● .Random Forest

STRUCTURE OF CODE

Importing Important Libraries

● pandas,numpy,nltk,re,future,matplotlib.pyplot

● train_test_split,GridSearchCV

● CountVectorizer, TfidfVectorizer

● TfidfTransformer

● BernoulliNB, MultinomialNB

● metrics,roc_auc_score

● accuracy_score,label_binarize,LogisticRegression

● Pipeline,svm,LinearSVC,SVR

● RandomForestClassifier,DecisionTreeClassifier

● BeautifulSoup,stopwords,SnowballStemmer

Reading CSV file

● Mounting from google drive or any local path ● Using pd.read_csv and encoding latin

Preprocessing

● Lowercasing the letter

● Removing Usernames

● Removing URLs

● Removing all digits

● Removing Quotations

● Replacing Emojis with their corresponding sentiment part eg : positive emoji or negative emojis

● Replacing contractions

● Removing punctuations

● Replacing double spaces with single spaces

● Showing Plots

● Showing Word clouds

● Used Count Vectorizer

Classifiers Used :

● Used Multinomial Naive Bayes

● Used Linear SVC

● Used Logistic Regression

● Used SVM

● Using Decision Trees

● Using Xgb

One has to simply open the colab file and keep on running all the codes.Give path for reading the csv file.The first 3 classifiers are showing the best results

Performance Measurements :

  1. Logistic Regression

image

  1. Multinomial Naive Bayes

image

  1. Linear SVC

image

Accuracy Comparison :

Below is the results of the accuracy results of all the three classifiers used above to predict the model.

image

We see that Logistic Regression has performed better as compared to the other 2.Linear SVC and Multinomial had almost done equally better.

twitter-sentiment-analysis's People

Contributors

ramkhandelwal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.