Code Monkey home page Code Monkey logo

document-similarity-20newsgroups-scikitlearn's Introduction

document-similarity-20newsgroups-scikitlearn

Famous 20 newsgroups documents are compared for similarity using scikitlearn library

Used the following vector representations

  1. Bag of words (Occurences Count)
  2. Tokenized representation
  3. Term frequency - Inverse document frequency (TF-IDF)

Document similarity(Cosine) between 20 news groups has been calculated using the above 3 representations. It is observed and verified that TF-IDF representaion has been the most effective way to find similarity between documents

Tradeoffs of three representations

  • Bag of words is the easiest representation of all, considering occurrence count alone.
  • Tokenized representation makes use of stemming. This is a better representation than the Bag of words, since it tries to reduce any kind of similar words (of same root), which do not necessarily provide us useful information on document classification.
  • TF-IDF is by far the best representation in terms of relevance. It makes use of term frequencies. It gives us good estimate on classifying two documents of different length. It also considers weights for words, rare words having more weight and commonly used words having low weight.

Heatmap - Bag of words (Occurrences count)

  • Most similar Newsgroups – soc.religion.christian, talk.politics.mideast
  • Least similar Newsgroups – comp.windows.x, misc.forsale alt text

Heatmap - Tokenized representation

  • Most similar Newsgroups – soc.religion.christian, talk.politics.mideast
  • Least similar Newsgroups – comp.windows.x, misc.forsale alt text

Heatmap - TF-IDF representation

  • Most similar Newsgroups – soc.religion.christian, talk.religion.misc
  • Least similar Newsgroups – comp.windows.x misc.forsale alt text

document-similarity-20newsgroups-scikitlearn's People

Contributors

vinaybysani avatar

Stargazers

 avatar

Watchers

 avatar  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.