weighted_quantile¶
yohou.interval.utils.weighted_quantile(x, q, weights)
¶
Compute weighted quantile using cumulative sum approach.
Weights are normalized to sum to 1 internally so that all quantile levels are computable regardless of the raw weight magnitude.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
Input array of values. |
required |
q
|
float
|
Quantile level to compute (between 0 and 1). The function
returns the smallest value |
required |
weights
|
ndarray
|
Weights for each value in x (must match length of x). |
required |
Returns¶
| Type | Description |
|---|---|
float
|
The weighted quantile value. |