Coder Social home page Coder Social logo

google / quickshift Goto Github PK

View Code? Open in Web Editor NEW
65.0 6.0 22.0 11 KB

A clustering algorithm that first finds the high-density regions (cluster-cores) of the data and then clusters the remaining points by hill-climbing. Such seedings act as more stable and expressive cluster-cores than the singleton modes found by popular algorithm such as mean shift. (https://arxiv.org/abs/1805.07909)

License: Apache License 2.0

Python 39.12% C++ 60.88%

quickshift's Introduction

Quickshift++ ====== This is not an officially supported Google product

Density-based clustering algorithm based on mode-seeking.

Usage

Initializiation:

QuickshiftPP(k, beta) 

k: number of neighbors in k-NN

beta: fluctuation parameter which ranges between 0 and 1.

Finding Clusters:

fit(X)

X is the data matrix, where each row is a datapoint in euclidean space.

fit performs the clustering. The final result can be found in QuickshiftPP.memberships.

Example (mixture of two gaussians):

from QuickshiftPP import *
import numpy as np

X = [np.random.normal(0, 1, 2) for i in range(100)] + [np.random.normal(5, 1, 2) for i in range(100)]
y = [0] * 100 + [1] * 100

# Declare a Quickshift++ model with tuning hyperparameters.
model = QuickshiftPP(k=20, beta=.5)

# Compute the clustering.
model.fit(X)
y_hat = model.memberships

from sklearn.metrics.cluster import adjusted_rand_score, adjusted_mutual_info_score
print("Adj. Rand Index Score: %f." % adjusted_rand_score(y_hat, y))
print("Adj. Mutual Info Score: %f." % adjusted_mutual_info_score(y_hat, y))

Install

This package uses distutils, which is the default way of installing python modules.

To install for all users on Unix/Linux:

sudo python setup.py build; python setup.py install

Dependencies =======

python 2.7, scikit-learn

quickshift's People

Contributors

hhjiang avatar jhorowitz 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

quickshift's Issues

Quick shift modal regression

Hi Heinrich - Was reading your paper "On the Consistency of Quick Shift" and was hoping you might be able to share some code with respect to the modal regression. I'd like to see if how it works with multi-output regression. Any chance you have anything available? Thanks much!

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.