# Online K-Means

### From Emcap

## Contents |

[edit]

## Online K-means Model

by Amaury Hazan <ahazan@iua.upf.edu>

Pompeu Fabra University

2008-04-08

[edit]

## What is the Module?

This is a module for performing online K-means clustering

[edit]

## What are the inputs and outputs?

**Inputs:**
A sequence of points in n dimension, eg:
[[0,1,2],[3,0,1],...,[2,3,5]]

**Outputs:**
The output is a clustering assignment for each point in the sequence

[edit]

## What are the parameters?

The parameters are

- eps: learning rate
- dim: dimensions of points to be procesed

[edit]

## What are the system requirements?

- Python 2.4 or higher:

Follow the instructions at: http://www.python.org/download/

- matplotlib 0.87 or higher (for graphical example)

[edit]

## How to Cite

@inProceedings{hazan2007c,

author = {Hazan, Amaury and Brossier, Paul and Marxer, Ricard and Purwins, Hendrik}, title = {What/when causal expectation modelling in monophonic pitched and percussive audio}, address = {Vancouver, Canada}, booktitle = {Music, Brain and Cognition. Part 2: Models of Sound and Cognition, part of the Neural Information Processing Conference)}, year = {2007}

}

[edit]

## How to Use, graphical example

# import the online k-means import online_kmeans # launch the example # it draws randomly n points from k gaussians # and tries to cluster them sequentially using learning rate eps online_kmeans.example2(k=4, epsilon=0.5, n=100, order='ordered', dim=2)