Git Product home page Git Product logo

agglomerative-hierarchical-clustering's Introduction

Agglomerative Hierarchical Clustering

Implements the Agglomerative Hierarchical Clustering algorithm.

Usage

To run the clustering program, you need to supply the following parameters on the command line:

  • Input file that contains the items to be clustered.

  • Number of disjointed clusters that we wish to extract.

  • Linkage criteria to use when calculating the distance metric.

    • s - Single linkage (default)
    • c - Complete linkage
    • a - Average linkage
    • t - Centroid linkage

For instance, the following is an example run:

$ ./agglomerate example.txt 3 s

In this example, we are running the hierarchical agglomerative clustering on the items in the input file example.txt. We are asking the program to generate 3 disjointed clusters using the single-linkage distance metric.

The input file

The input file contains the items to be clustered.

<number of items to cluster>
<label string>| <x-axis value> <y-axis value>
...

For instance, the following is a valid input. It contains 12 data points, where each data point is referred to by its label and has coordinates in the two-dimensional Euclidean plane.

12
A| 1.0 1.0
B| 2.0 1.0
C| 2.0 2.0
D| 4.0 5.0
E| 5.0 4.0
F| 5.0 5.0
G| 5.0 6.0
H| 6.0 5.0
I| 9.0 9.0
J| 10.0 9.0
K| 10.0 10.0
L| 11.0 9.0

After running the clustering algorithm, we get the following hierarchy:

Example agglomerative hierarchical clustering

The cluster hierarchy may be represented by the binary tree:

Example clustering as a binary tree

For further details, please visit my [homepage](http://yaikhom.com/2014/08/21/ agglomerative-hierarchical-clustering.html).

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.