Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 608 Bytes

File metadata and controls

22 lines (18 loc) · 608 Bytes

K-MEANS Clusters PHP Library

It is a simple PHP library to integrate and get clusters with implementation of kmeans

Live Demo

http://spider.nitt.edu/~cppxaxa/kmeans/

Usage

You need to provide k value to get clusters.

$obj = new Wrapper();
$obj->k = 2;
$obj->limit = 10;
$obj->set = array();
$obj->set[] = new DataSet(10, 20);
$obj->set[] = new DataSet(10, 21);
$obj->set[] = new DataSet(30, 20);
$obj->set[] = new DataSet(35, 30);

echo kmeans( json_encode($obj) );

Reference

http://dni-institute.in/blogs/k-means-clustering-algorithm-explained/