Giter Site home page Giter Site logo

epapagia / unsupervised-learning-document-clustering Goto Github PK

View Code? Open in Web Editor NEW

This project forked from utkuozbulak/unsupervised-learning-document-clustering

0.0 1.0 0.0 10.04 MB

Document clustering and topic modelling with Python

Python 100.00%

unsupervised-learning-document-clustering's Introduction

Document Clustering with Python

This is a project to apply document clustering techniques using Python. For this exercise, we started out with texts of 24 books taken from Google as part of Google Library Project.

Data Cleaning

The files were read using an OCR system and contained HTML tags all over the place so the first step before starting the clustering was data cleaning. Data cleaning process was like below:

1- Get rid of HTML Tags (with Python HTMLParser Library)

2- Remove punctuations

3- Remove non-English characters

4- Lowercase all the words

5- Stem the words using Porter Stemmer

6- Remove all stop words

7- Remove high frequency words ( Words with 75%+ occurance rate in all books )

Document Similarity

After cleaning the data, next step is to find the document similarity matrix and sparse document vectors using TF-IDF. Below is the representation of of similarity matrix.

TFIDF

Clustering and Dimensionality Reduction

After obtaining similarity matrix and sparse vectors of documents from TF-IDF, we started applying clustering techniques and used dimensionality reduction techniques to be able to visualise it in 2D.

K-Means and Principle Component Analysis

K-means clustering is one of the popular clustering techniques, with K=5 and PCA dimensioanlity reduction, it generated following output.

KPCA

DBScan and Multidimensional Scaling

DBScan is yet another clustering algorithm we can use to cluster the documents. With epsilon value 1.2, it generates 4 clusters and if we combine it with MDS, it generates following output.

DBSMDS

Hierarchical Clustering with WARD

WARD's method is commonly used to generate hierarchical clusters, below is the generated hierarchical clustering plot if we apply it to our documents.

WARD

Package Info

/src/ contains all the code to generate the plots

/cleaned_data/ contains cleaned data (The data after the cleaning step)

/plots/ contains generated images

unsupervised-learning-document-clustering's People

Contributors

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