compute_optimal_k (adaptive_sizer.rs)

headroom · analytics

Adaptive compression sizing via information saturation detection. ! ! Direct port of `headroom/transforms/adaptive_sizer.py`. Used by ! `smart_crusher`'s array crushers to decide *how many* items to keep — ! statistically, by detecting the "knee point" of an information ! satur

// Source: https://github.com/headroomlabs-ai/headroom | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
//! Adaptive compression sizing via information saturation detection.
//!
//! Direct port of `headroom/transforms/adaptive_sizer.py`. Used by
//! `smart_crusher`'s array crushers to decide *how many* items to keep —
//! statistically, by detecting the "knee point" of an information
//! saturation curve.
//!
//! # Algorithm overview
//!
//! Three-tier decision:
//! 1. **Fast path**: trivial cases (`n <= 8` → keep all) and near-total
//!    redundancy (≤3 unique-by-simhash → keep that count).
//! 2. **Standard**: Kneedle on cumulative unique-bigram coverage curve.
//!    Coverage s

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key