PHPackages                             webd/clustering - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. webd/clustering

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

webd/clustering
===============

Clustering algorithms

8942PHP

Since Dec 31Pushed 11y ago3 watchersCompare

[ Source](https://github.com/tdebatty/php-clustering)[ Packagist](https://packagist.org/packages/webd/clustering)[ RSS](/packages/webd-clustering/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (1)Used By (0)

php-clustering
==============

[](#php-clustering)

Clustering algorithms for PHP

Usage
-----

[](#usage)

```
use \webd\clustering\KMeans;
use \webd\clustering\GMeans;
use \webd\clustering\RnPoint;

// These examples use points in Rn, but some algorithms (like KMeans)
// support points in non-euclidean spaces
$points = array(
    new RnPoint(array(1, 1)),
    new RnPoint(array(2, 2)),
    new RnPoint(array(2, 3))
);

// Simple KMeans
$kmeans = new KMeans;
$kmeans->k = 2;
$kmeans->n = 10;
$kmeans->points = $points;
$kmeans->run();

var_dump($kmeans->centers);

// GMeans (no need to specify the number of clusters)
$nd = new \webd\stats\NormalDistribution();

// Create points around (1, 1) and (9, 9)
$points = array();
for ($i = 0; $i < 100; $i++) {
    $points[] = new RnPoint($nd->sample()+1, $nd->sample()+1);
    $points[] = new RnPoint($nd->sample()+9, $nd->sample()+9);
}

$gmeans = new GMeans();
$gmeans->points = $points;
$gmeans->run();
var_dump($gmeans->found_centers);
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c315a5fa6bd564f98127e90046ff629dad5a22cd509cc53d07f5858c85b08fc?d=identicon)[tdebatty](/maintainers/tdebatty)

---

Top Contributors

[![tdebatty](https://avatars.githubusercontent.com/u/872972?v=4)](https://github.com/tdebatty "tdebatty (8 commits)")

### Embed Badge

![Health badge](/badges/webd-clustering/health.svg)

```
[![Health](https://phpackages.com/badges/webd-clustering/health.svg)](https://phpackages.com/packages/webd-clustering)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
