我想知道使用什么算法来确定 Seaborn 箱线图分布中的“异常值”。
在他们的网站seaborn.boxplot 上,他们简单说明:
该框显示数据集的四分位数,而胡须延伸以显示分布的其余部分,但使用作为四分位间距函数的方法确定为“异常值”的点除外。
我真的很想知道他们使用什么方法。我从数据框创建了箱线图,似乎有很多“异常值”。
小智 8
你可以这样计算:
Q1 = df.quartile(0.25)
Q3 = df.quartile(0.75)
IQR = Q3 - Q1
Run Code Online (Sandbox Code Playgroud)
如果小于以下值,则为异常值:
Q1 - 1.5 * IQR
Run Code Online (Sandbox Code Playgroud)
或者如果它大于:
Q3 + 1.5 * IQR
Run Code Online (Sandbox Code Playgroud)
如果您在链接的页面上进一步阅读(或按 ctrl-f 表示“异常值”),您将看到:
whis : float, optional
Proportion of the IQR past the low and high quartiles to extend the plot whiskers.
Points outside this range will be identified as outliers.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10022 次 |
| 最近记录: |