scikit-learn/scikit-learn — pull request #3802 by MechCoder (2014-10-24 16:42:20+00:00)
Title: [WIP] Clustering algorithm - BIRCH (Proof of Concept)

Fixes https://github.com/scikit-learn/scikit-learn/issues/2690

The design is similar to the Java code written here https://code.google.com/p/jbirch/
I am pretty much sure it works (If the JAVA implementation is correct, ofc), since I get the same clusters for both cases. I opened this as a Proof of Concept.

This example has been modified, http://scikit-learn.org/stable/auto_examples/cluster/plot_mini_batch_kmeans.html

When `threshold` is set to 3.0

![figure_1](https://cloud.githubusercontent.com/assets/1867024/4772737/1dd8604a-5b9b-11e4-800d-aea031410a30.png)

When `threshold` is set to 1.0

![figure_2](https://cloud.githubusercontent.com/assets/1867024/4772748/2e46daec-5b9b-11e4-8f49-672b0ada17b7.png)

TODO: A LOT

- [ ] This is just a PoC and is really slow as compared to kmeans. It is obvious that one should use Cython for insertion into the tree.
- [ ] There is a merging refinement, that is described in the paper which I have not implemented yet.
- [ ] After a certain number of insertions, there is an option to rebuild the tree, if it goes beyond a certain memory
- [ ] Only the Euclidean metric has been added, there should be support for other metrics.
- [ ] Support for sparse matrices, but I doubt this can be done, given the concept of Linear Sum and Squared Sum in this model.
- [ ] More tests, I have just added a sanity test.

Awating some initial feedback!