Dbscan1d
An efficient 1D implementation of the DBSCAN clustering algorithm
Install / Use
/learn @d-chambers/Dbscan1dREADME
DBSCAN1D
dbscan1d is a 1D implementation of the DBSCAN algorithm. It was created to efficiently perform clustering on large 1D arrays.
Sci-kit Learn's DBSCAN implementation does not have a special case for 1D, where calculating the full distance matrix is wasteful. It is much better to simply sort the input array and perform efficient bisects for finding closest points. Here are the results of running the simple profile script included with the package. In every case DBSCAN1D is much faster than scikit learn's implementation.

Installation
Simply use pip to install dbscan1d:
pip install dbscan1d
It only requires numpy.
Quickstart
dbscan1d is designed to be interchangeable with sklearn's implementation in almost all cases.
from sklearn.datasets import make_blobs
from dbscan1d.core import DBSCAN1D
# make blobs to test clustering
X = make_blobs(1_000_000, centers=2, n_features=1)[0]
# init dbscan object
dbs = DBSCAN1D(eps=.5, min_samples=4)
# get labels for each point
labels = dbs.fit_predict(X)
# show core point indices
dbs.core_sample_indices_
# get values of core points
dbs.components_
Notes
- dbscan1d can return different group numbers than sklearn for non-core points which are within
eps distances of core points for two separate groups. For example:
--C1--C1--P--C2--C2Here C1 and C2 are core points for group 1 and group 2, respectively. If P is within eps of both C1 and C2, dbscan1d will assign it the same label as the core point that is closest. Sklearn doesn't always do this.
Related Skills
claude-opus-4-5-migration
110.6kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
model-usage
351.2kUse 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.
TrendRadar
51.1k⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。
mcp-for-beginners
15.8kThis open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.

