Skip to content

Commit 12d5fe4

Browse files
author
miranov25
committed
docs(quantile_fit_nd): add Discrete Inputs policy and utilities
- Explain continuous-Q assumption and discrete preprocessing (PIT/mid-ranks) - Add utils: discrete_to_uniform_rank_poisson / _empirical for reuse
1 parent 30b7ee7 commit 12d5fe4

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

UTILS/dfextensions/quantile_fit_nd/quantile_fit_nd.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,30 @@ Drift/stability analysis is expected in external tooling by **chaining** calibra
229229
| `nuisance_axes` | `{"z": "z_vtx"}` | Axes for smoothing |
230230

231231
---
232+
## 14. Discrete Inputs (policy)
232233

233-
## 14. Future extensions
234+
**Assumption:** Within each sliding window \(|Q - q_0| \le \Delta q\), the rank \(Q\) has enough spread to estimate a slope.
235+
236+
For **discrete sources** (e.g. integer tracks/clusters, Poisson-like):
237+
convert counts to a continuous rank **before** calling the fitter:
238+
239+
- **Randomized PIT (preferred):**
240+
\( U = F(k-1) + V\,[F(k)-F(k-1)], \ V\sim \mathrm{Unif}(0,1) \)
241+
(exact Uniform(0,1), information-preserving).
242+
- **Mid-ranks (deterministic):**
243+
\( \tilde U = \tfrac{F(k-1)+F(k)}{2} \).
244+
245+
Helpers provided:
246+
- `discrete_to_uniform_rank_poisson(k, lam, mode='randomized'|'midrank')`
247+
- `discrete_to_uniform_rank_empirical(x, mode='randomized'|'midrank')`
248+
249+
The core fitter does **not** widen Δq or inject noise; it will label windows
250+
with insufficient spread as `low_Q_spread`. This separation keeps the
251+
calibration math transparent and reproducible.
252+
253+
254+
255+
## 15. Future extensions
234256

235257
* Optional **Huber** robust regression mode.
236258
* Degree-2 local fits with derivative-based monotonicity checks.

0 commit comments

Comments
 (0)