Giter VIP home page Giter VIP logo

unsupervised-sentiment-analysis's Introduction

Unsupervised-Sentiment-Analysis

How to extract sentiment from the data without any labels

Repo for towardsdatascience article: https://towardsdatascience.com/unsupervised-sentiment-analysis-a38bf1906483 about Unsupervised Sentiment Analysis on Polish Sentiment Dataset.

Analyzed dataset comes from wonderful article by Szymon Płotka: https://ermlab.com/en/blog/nlp/polish-sentiment-analysis-using-keras-and-word2vec/

Dataset was analyzed using Word2Vec algorithm, KMeans clustering, and tfidf weighting. Based on word embeddings trained for given dataset using gensim's Word2Vec implementation, there was an unsupervised sentiment analysis performed, which achieved scores presented below. Main steps included detection of negative and positive clusters in word vectors space with use of sklearn's implementation of KMeans clustering algorithm, which were then used to transform every sentence into vector of replaced sentiment scores for a given words in a sentence. Second vector for given sentence was obtained through replacing all words in a sentence with their corresponding tfidf-scores. Final prediction was obtained as a dot product from these two vectors for each sentence - if their dot product was positive, the overall sentiment was predicted as positive, and if dot product was negative, overall sentiment was predicted as negative. Details are described in the article linked at the begining, hope it will be useful for anyone! :)

Confusion Matrix
╔═══════════╦════════════════════╦═══════════════╗
║           ║         0          ║       1       ║
╠═══════════╬════════════════════╬═══════════════╣
║     0     ║        9523        ║       306     ║
╠═══════════╬════════════════════╬═══════════════╣
║     1     ║       127125       ║     508277    ║
╚═══════════╩════════════════════╩═══════════════╝




╔═══════════╦════════════════════╗
║   Scores  ║                    ║
╠═══════════╬════════════════════╣
║ accuracy  ║ 0.802503           ║
║ precision ║ 0.999398           ║
║ recall    ║ 0.799930           ║
║ F1        ║ 0.888608           ║
╚═══════════╩════════════════════╝

unsupervised-sentiment-analysis's People

Contributors

rafaljanwojcik avatar mmchougule avatar

Watchers

James Cloos 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.