Giter Club home page Giter Club logo

varclus's Introduction

variable-clustering

A re-creation of SAS Varclus procedure in Python. Varclus is a very useful decomposition and dimensionality reduction tool when a large dataframe with numerous features is dealt with.

Varclus has several advantages and disadvantages over other decomposition and dimensionality reduction algorithms such as PCA and K-means

Advantages

  • Final results are real features, not made-up components
  • Hierarchical structure that could be more meaningful to business
  • Easy to use for feature swapping when needed (business requirement, regulatory constraint, etc.)

Disadvantages

  • Oblique decomposition which could yield highly correlated clusters
  • Algorithmic expensive.
  • Not optimal in dimensionality reduction

Description of the algorithm

The algorithm is a recurisve process that tries to decompose each child cluster based on the same critera (number of splits, max eigenvalue). Below is a detailed description of each recursion

  1. Conducts PCA on current feature space. If the max eigenvalue is smaller than the specified threshold, stop the decomposition process
  2. Calculates the first N PCA components and assign features to these components based on absolute correlation from high to low. These components are the initial centroids of these child clusters.
  3. After initial assignment, the algorithm conducts an iterative assignment called Nearest Component Sorting (NCS). Basically, the centroid vectors are re-computed as the first components of the child clusters and the algorithm will re-assign each of the feature based on the same correlation rule.
  4. After NCS, the algorithm tries to increase the total variance explained by the first PCA component of each child cluster by re-assigning features across clusters

Other comments

  • As the same with other unsupervised clustering methods, multiple hyperparameters need to be tuned
  • Trade-off between art and science
  • Right now, the algorithm only supports hierarchical decomposition and using first PCA component as the centroid. In SAS Proc Varclus, one can also specify global re-assignment and using mean vector as the centroid
  • Please see demo.ipynb for more detailed information
  • Dependencies: pandas, np, sklearn

varclus's People

Contributors

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