架构师大咖
架构师大咖,打造有价值的架构师交流平台。分享架构师干货、教程、课程、资讯。架构师大咖,每日推送。
公众号该公众号已被封禁一、基于分布的方法1. 3sigma基于正态分布,3sigma准则认为超过3sigma的数据为异常点。图1: 3sigmadef three_sigma(s): mu, std = np.mean(s), np.std(s) lower, upper = mu-3*std, mu+3*std return lower, upper2. Z-scoreZ-score为标准分数,测量数据点和平均值的距离,若A与平均值相差2个标准差,Z-score为2。当把Z-score=3作为阈值去剔除异常点时,便相当于3sigma。def z_score(s): z_score = (s - np.mean(s)) / np.std(s) return z_score3. boxplot箱线图时基于四分位距(IQR)找异常点的。图2: boxplotdef boxplot(s): q1, q3 = s.quantile(.25), s.quantile(.75) iqr = q3 - q1 lower, upper = q1 -
………………………………