# Clustering

> Unsupervised clustering: K-Means, DBSCAN, hierarchical agglomerative, Gaussian Mixture Models, and spectral clustering. Includes optimal cluster count determination, validation metrics, and cluster profiling. Use when discovering natural groups in data.

- **Type:** Skill
- **Install:** `agentstack add skill-ericwang915-data-scientist-skills-clustering`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [ericwang915](https://agentstack.voostack.com/s/ericwang915)
- **Installs:** 0
- **Category:** [Data & Analytics](https://agentstack.voostack.com/c/data-and-analytics)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [ericwang915](https://github.com/ericwang915)
- **Source:** https://github.com/ericwang915/data-scientist-skills/tree/main/ds-machine-learning/skills/clustering

## Install

```sh
agentstack add skill-ericwang915-data-scientist-skills-clustering
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Clustering

## Purpose
Discover natural groupings in data without predefined labels. Includes cluster validation and business-ready profiling.

## How It Works

### Step 1: Preprocessing
- Standardize/normalize features (critical for distance-based methods)
- Reduce dimensions if needed (PCA, UMAP for visualization)
- Handle mixed data types (Gower distance, k-prototypes)

### Step 2: Choose Algorithm

| Algorithm | Best For | Requires K? |
|-----------|----------|-------------|
| K-Means | Spherical clusters, large datasets | Yes |
| DBSCAN | Arbitrary shapes, noise handling | No (ε, minPts) |
| Hierarchical | Small datasets, dendrogram visualization | Optional |
| Gaussian Mixture | Elliptical clusters, soft assignments | Yes |
| Spectral | Complex shapes, graph-based | Yes |
| HDBSCAN | Variable density, robust | No |

### Step 3: Determine Optimal Clusters
- **Elbow method**: Within-cluster sum of squares
- **Silhouette score**: Cluster separation quality (-1 to 1)
- **Gap statistic**: Compare with reference distribution
- **Dendrogram**: Visual hierarchy (hierarchical clustering)
- **BIC/AIC**: Model-based selection (GMM)

### Step 4: Validate & Profile
- Silhouette analysis per cluster
- Cluster stability (bootstrap resampling)
- Profile each cluster: mean features, distinguishing characteristics
- Business naming: assign descriptive labels

## Usage Examples

```
"Segment our customers into groups based on purchase behavior,
engagement metrics, and demographics"
```

```
"Find natural groupings in this sensor data — I don't know
how many clusters there should be"
```

## Output Format

- **Cluster Summary**: Size, key characteristics per cluster
- **Validation Metrics**: Silhouette, stability scores
- **Visualization**: 2D/3D scatter with cluster colors, dendrogram
- **Profiles**: Feature means/distributions per cluster with business labels
- **Python Code**: sklearn implementation

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [ericwang915](https://github.com/ericwang915)
- **Source:** [ericwang915/data-scientist-skills](https://github.com/ericwang915/data-scientist-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-ericwang915-data-scientist-skills-clustering
- Seller: https://agentstack.voostack.com/s/ericwang915
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
