Applies to: ✅Microsoft Fabric✅Azure Data Explorer✅Azure Monitor✅Microsoft Sentinel
The percentile()
function calculates an estimate for the specified nearest-rank percentile of the population defined by expr.
정확도는 백분위수 지역의 인구 밀도에 따라 달라집니다.
percentiles()
는 다음과 유사하게 percentile()
작동합니다. 그러나 percentiles()
한 번에 여러 백분위수 값을 계산할 수 있습니다. 이 값은 각 백분위수 값을 개별적으로 계산하는 것보다 더 효율적입니다.
To calculate weighted percentiles, see percentilesw().
Note
This function is used in conjunction with the summarize operator.
Syntax
percentile(
expr,
percentile)
percentiles(
expr,
percentiles)
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
expr | string |
✔️ | 집계 계산에 사용할 식입니다. |
percentile | real | ✔️ | 백분위수로 지정하는 상수입니다. |
percentiles | real | ✔️ | 하나 이상의 쉼표로 구분된 백분위수입니다. |
Returns
Returns a table with the estimates for expr of the specified percentiles in the group, each in a separate column.
Note
단일 열의 백분위수 값을 반환하려면 백분위수 반환을 배열로 참조하세요.
Examples
이 섹션의 예제에서는 구문을 사용하여 시작하는 방법을 보여 줍니다.
The examples in this article use publicly available tables in the help cluster, such as the
StormEvents
table in the Samples database.
The examples in this article use publicly available tables, such as the
Weather
table in the Weather analytics sample gallery. 작업 영역의 테이블과 일치하도록 예제 쿼리에서 테이블 이름을 수정해야 할 수 있습니다.
단일 백분위수 계산
다음 예제에서는 샘플 집합의 DamageProperty
95%보다 크고 샘플 집합의 5% 미만인 값을 보여 있습니다.
StormEvents | summarize percentile(DamageProperty, 95) by State
Output
표시된 결과 테이블에는 처음 10개의 행만 포함됩니다.
State | percentile_DamageProperty_95 |
---|---|
ATLANTIC SOUTH | 0 |
FLORIDA | 40000 |
GEORGIA | 143333 |
MISSISSIPPI | 80000 |
AMERICAN SAMOA | 250000 |
KENTUCKY | 35000 |
OHIO | 150000 |
KANSAS | 51392 |
MICHIGAN | 49167 |
ALABAMA | 50000 |
여러 백분위수 계산
다음 예제에서는 5, 50(중앙값) 및 95를 사용하여 동시에 계산된 값을 DamageProperty
보여 줍니다.
StormEvents | summarize percentiles(DamageProperty, 5, 50, 95) by State
Output
표시된 결과 테이블에는 처음 10개의 행만 포함됩니다.
State | percentile_DamageProperty_5 | percentile_DamageProperty_50 | percentile_DamageProperty_95 |
---|---|---|---|
ATLANTIC SOUTH | 0 | 0 | 0 |
FLORIDA | 0 | 0 | 40000 |
GEORGIA | 0 | 0 | 143333 |
MISSISSIPPI | 0 | 0 | 80000 |
AMERICAN SAMOA | 0 | 0 | 250000 |
KENTUCKY | 0 | 0 | 35000 |
OHIO | 0 | 2000 | 150000 |
KANSAS | 0 | 0 | 51392 |
MICHIGAN | 0 | 0 | 49167 |
ALABAMA | 0 | 0 | 50000 |
... | ... |
백분위수 배열로 반환
개별 열의 값을 반환하는 대신 함수를 percentiles_array()
사용하여 동적 배열 형식의 단일 열에 백분위수 값을 반환합니다.
Syntax
percentiles_array(
expr,
percentiles)
Parameters
Name | Type | Required | Description |
---|---|---|---|
expr | string |
✔️ | 집계 계산에 사용할 식입니다. |
percentiles | 실제 또는 동적 | ✔️ | 하나 이상의 쉼표로 구분된 백분위수 또는 백분위수의 동적 배열입니다. 각 백분위수는 실제 값이어야 합니다. |
Returns
Returns an estimate for expr of the specified percentiles in the group as a single column of dynamic array type.
Examples
Comma-separated percentiles
Multiple percentiles can be obtained as an array in a single dynamic column, instead of in multiple columns as with percentiles().
TransformedSensorsData
| summarize percentiles_array(Value, 5, 25, 50, 75, 95), avg(Value) by SensorName
Output
결과 테이블에는 처음 10개 행만 표시됩니다.
SensorName | percentiles_Value | avg_Value |
---|---|---|
sensor-82 | ["0.048141473520867069","0.24407515500271132","0.48974511106780577","0.74160998970950343","0.94587903204190071"] | 0.493950914 |
sensor-130 | ["0.049200214398937764","0.25735850440187535","0.51206374010048239","0.74182335059053839","0.95210342463616771"] | 0.505111463 |
sensor-56 | ["0.04857779335488676","0.24709868149337144","0.49668762923789589","0.74458470404241883","0.94889104840865857"] | 0.497955018 |
sensor-24 | ["0.051507199150534679","0.24803904945640423","0.50397070213183581","0.75653888126010793","0.9518782718727431"] | 0.501084379 |
sensor-47 | ["0.045991246974755672","0.24644331118208851","0.48089197707088743","0.74475142784472248","0.9518322864959039"] | 0.49386228 |
sensor-135 | ["0.05132897529660399","0.24204987641954018","0.48470113942206461","0.74275730068433621","0.94784079559229406"] | 0.494817619 |
sensor-74 | ["0.048914714739047828","0.25160926036445724","0.49832498850160978","0.75257887767110776","0.94932261924236094"] | 0.501627252 |
sensor-173 | ["0.048333149363009836","0.26084250046756496","0.51288012531934613","0.74964772791583412","0.95156058795294"] | 0.505401226 |
sensor-28 | ["0.048511161184567046","0.2547387968731824","0.50101318228599656","0.75693845702682039","0.95243122486483989"] | 0.502066244 |
sensor-34 | ["0.049980293859462954","0.25094722564949412","0.50914023067384762","0.75571549713447961","0.95176564809278674"] | 0.504309494 |
... | ... | ... |
백분위수의 동적 배열
정 percentiles_array
수 또는 부동 소수점 숫자의 동적 배열에서 백분위수를 지정할 수 있습니다. 배열은 상수여야 하지만 리터럴일 필요는 없습니다.
TransformedSensorsData
| summarize percentiles_array(Value, dynamic([5, 25, 50, 75, 95])), avg(Value) by SensorName
Output
결과 테이블에는 처음 10개 행만 표시됩니다.
SensorName | percentiles_Value | avg_Value |
---|---|---|
sensor-82 | ["0.048141473520867069","0.24407515500271132","0.48974511106780577","0.74160998970950343","0.94587903204190071"] | 0.493950914 |
sensor-130 | ["0.049200214398937764","0.25735850440187535","0.51206374010048239","0.74182335059053839","0.95210342463616771"] | 0.505111463 |
sensor-56 | ["0.04857779335488676","0.24709868149337144","0.49668762923789589","0.74458470404241883","0.94889104840865857"] | 0.497955018 |
sensor-24 | ["0.051507199150534679","0.24803904945640423","0.50397070213183581","0.75653888126010793","0.9518782718727431"] | 0.501084379 |
sensor-47 | ["0.045991246974755672","0.24644331118208851","0.48089197707088743","0.74475142784472248","0.9518322864959039"] | 0.49386228 |
sensor-135 | ["0.05132897529660399","0.24204987641954018","0.48470113942206461","0.74275730068433621","0.94784079559229406"] | 0.494817619 |
sensor-74 | ["0.048914714739047828","0.25160926036445724","0.49832498850160978","0.75257887767110776","0.94932261924236094"] | 0.501627252 |
sensor-173 | ["0.048333149363009836","0.26084250046756496","0.51288012531934613","0.74964772791583412","0.95156058795294"] | 0.505401226 |
sensor-28 | ["0.048511161184567046","0.2547387968731824","0.50101318228599656","0.75693845702682039","0.95243122486483989"] | 0.502066244 |
sensor-34 | ["0.049980293859462954","0.25094722564949412","0.50914023067384762","0.75571549713447961","0.95176564809278674"] | 0.504309494 |
... | ... | ... |
Nearest-rank percentile
P-th percentile (0 <P<= 100) of a list of ordered values, sorted in ascending order, is the smallest value in the list. The P percent of the data is less or equal to P-th percentile value (from Wikipedia article on percentiles).
Define 0-th percentiles to be the smallest member of the population.
Note
계산의 근사 특성을 고려할 때 실제 반환 값은 모집단의 멤버가 아닐 수 있습니다. Nearest-rank definition means that P=50 does not conform to the interpolative definition of the median. When evaluating the significance of this discrepancy for the specific application, the size of the population and an estimation error should be taken into account.
백분위수의 예측 오류
The percentiles aggregate provides an approximate value using T-Digest.
Note
- 예측 오류의 범위는 요청된 백분위수의 값에 따라 달라집니다. 최고의 정확도는 [0..100] 눈금의 양쪽 끝에 있습니다. 백분위수 0과 100은 분포의 정확한 최소값과 최대값입니다. 정확도는 눈금의 중앙으로 갈수록 서서히 감소합니다. 중앙값에서 최악이며 1%로 제한됩니다.
- 오류 범위는 값이 아니라 순위에서 관찰됩니다. 백분위수(X, 50)가 Xm 값을 반환한다고 가정합니다. 예측값은 X 값의 최소 49%와 최대 51%가 Xm 이하임을 보장합니다. Xm과 X의 실제 중앙값 간의 차이에 대한 이론적 제한은 없습니다.
- 예측은 경우에 따라 정확한 값을 생성할 수 있지만 언제 정확한지 정의할 수 있는 신뢰할 수 있는 조건이 없습니다.