Pyclugen
Multidimensional cluster generation in Python
Install / Use
/learn @clugen/PyclugenREADME
pyclugen
pyclugen is a Python implementation of the clugen algorithm for generating multidimensional clusters with arbitrary distributions. Each cluster is supported by a line segment, the position, orientation and length of which guide where the respective points are placed.
See the documentation and examples for more details.
Installation
Install from PyPI:
pip install --upgrade pip
pip install pyclugen
Or directly from GitHub:
pip install --upgrade pip
pip install git+https://github.com/clugen/pyclugen.git#egg=pyclugen
Quick start
from pyclugen import clugen
import matplotlib.pyplot as plt
out2 = clugen(2, 4, 400, [1, 0], 0.4, [50, 10], 20, 1, 2)
plt.scatter(out2.points[:, 0], out2.points[:, 1], c=out2.clusters)
plt.show()

out3 = clugen(3, 5, 10000, [0.5, 0.5, 0.5], 0.2, [10, 10, 10], 10, 1, 2)
fig = plt.figure()
ax = fig.add_subplot(projection="3d")
ax.scatter(out3.points[:, 0], out3.points[:, 1], out3.points[:, 2], c=out3.clusters)
plt.show()

See also
- CluGen.jl, a Julia implementation of the clugen algorithm.
- clugenr, an R implementation of the clugen algorithm.
- MOCluGen, a MATLAB/Octave implementation of the clugen algorithm.
Reference
If you use this software, please cite the following reference:
- Fachada, N. & de Andrade, D. (2023). Generating multidimensional clusters with support lines. Knowledge-Based Systems, 277, 110836. https://doi.org/10.1016/j.knosys.2023.110836 (arXiv preprint)
License
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
96.8kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
344.1kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
