Code Monkey home page Code Monkey logo

mst_clustering's Introduction

Minimum Spanning Tree Clustering

build status version status license DOI JOSS

This package implements a simple scikit-learn style estimator for clustering with a minimum spanning tree.

Motivation

Automated clustering can be an important means of identifying structure in data, but many of the more popular clustering algorithms do not perform well in the presence of background noise. The clustering algorithm implemented here, based on a trimmed Euclidean Minimum Spanning Tree, can be useful in this case.

Example

The API of the mst_clustering code is designed for compatibility with the scikit-learn project.

from mst_clustering import MSTClustering
from sklearn.datasets import make_blobs
import matplotlib.pyplot as plt

# create some data with four clusters
X, y = make_blobs(200, centers=4, random_state=42)

# predict the labels with the MST algorithm
model = MSTClustering(cutoff_scale=2)
labels = model.fit_predict(X)

# plot the results
plt.scatter(X[:, 0], X[:, 1], c=labels, cmap='rainbow');

Simple Clustering Plot

For a detailed explanation of the algorithm and a more interesting example of it in action, see the MST Clustering Notebook.

Installation & Requirements

The mst_clustering package itself is fairly lightweight. It is tested on Python 2.7 and 3.4-3.5, and depends on the following packages:

Using the cross-platform conda package manager, these requirements can be installed as follows:

$ conda install numpy scipy scikit-learn

Finally, the current release of mst_clustering can be installed using pip:

$ conda install pip  # if using conda
$ pip install mst_clustering

To install mst_clustering from source, first download the source repository and then run

$ python setup.py install

Contributing & Reporting Issues

Bug reports, questions, suggestions, and contributions are welcome. For these, please make use the Issues or Pull Requests associated with this repository.

Citing

If you use this code in an academic publication, please consider citing this JOSS Paper.

mst_clustering's People

Contributors

jakevdp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mst_clustering's Issues

Apply the algorithm for a adjacency matrix

I have a weighted undirected graph and i want to apply this algorithm to find clusters relatively with the affinities between the nodes.

Do you know if i could succeed this?

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.