当前位置:网站首页>Data analysis series 3 σ Rule / eliminate outliers according to laida criterion
Data analysis series 3 σ Rule / eliminate outliers according to laida criterion
2022-07-07 23:45:00 【Lang Xiaolin】
1 Related principles
3σ The principle is
The values are distributed in (μ-σ,μ+σ) The probability of 0.6827
The values are distributed in (μ-2σ,μ+2σ) The probability of 0.9545
The values are distributed in (μ-3σ,μ+3σ) The probability of 0.9973
It can be said that ,Y The values of are almost all concentrated in (μ-3σ,μ+3σ) Within the interval , There is no possibility of going beyond that 0.3%.
2 Code implementation
public class Pauta{
// Create the laida class
private double arr[]; // Accept raw array
public Pauta(double temp[]) {
// The original array obtained by the construction method
this.arr=temp;
System.out.print(" The original array :");
for(double x:arr) {
System.out.print(x+"、");
}
System.out.println();
}
public double average() {
// The arithmetic average method of the original array
double sum=0;
for(int x=0;x<arr.length;x++)
sum+=arr[x];
}
return sum/arr.length;
}
public double[] residualError() {
// Residual error method of the original array
double rE[]=new double[] {
};
for(int x=0;x<arr.length;x++) {
rE[x]=arr[x]-average();
}
return rE;
}
public double standardVariance() {
// How to calculate the standard variance value of the original array
double sum=0;
for(int int x=0;x<arr.length;x++) {
sum+=Math.pow(arr[x]-average(),2);
}
return Math.sqrt(sum/(arr.length-1));
}
public void judge() {
// How to judge outliers , If abnormal , The output
for(int int x=0;x<arr.length;x++) {
if(Math.abs(arr[x]-average())>(3*standardVariance())) {
System.out.println(" The... Th in the array "+(x+1)+" Elements belong to outliers ");
}
}
}
}
public class client{
public static void main(String args[]) {
double data[]=new double[] {
1,2,8,10,8,5,2,4,6,11,15};// The original array
Pauta pau=new Pauta(data);// The original array is output after encapsulation
System.out.println(" Count the average :"+pau.average());// Count the average
/* The residual error output here is slightly */
System.out.println(" Standard deviation :"+pau.standardVariance());// Standard deviation
pau.judge();// How to judge outliers
}
}
Reference material :
https://wenku.baidu.com/view/cce8bacc142ded630b1c59eef8c75fbfc77d9407.html JAVA Use :3σ The rules 、 The procedure of eliminating outliers according to the laida criterion
边栏推荐
- 蓝桥ROS中使用fishros一键安装
- HDU - 1260 Tickets(线性DP)
- Open source hardware small project: anxinco esp-c3f control ws2812
- Pycharm basic settings latest version 2022
- Chisel tutorial - 05 Sequential logic in chisel (including explicit multi clock, explicit synchronous reset and explicit asynchronous reset)
- Pycharm essential plug-in, change the background (self use, continuous update) | CSDN creation punch in
- SAP HR奖罚信息导出
- 神奇快速幂
- 0-1 knapsack problem
- C number of words, plus ¥, longest word, average value
猜你喜欢
B_ QuRT_ User_ Guide(38)
SAP memory parameter tuning process
2022 certified surveyors are still at a loss when preparing for the exam? Teach you how to take the exam hand in hand?
SAP HR奖罚信息导出
Open source hardware small project: anxinco esp-c3f control ws2812
SAP HR 社会工作经历 0023
UIC564-2 附录4 –阻燃防火测试:火焰的扩散
Markdown
神奇快速幂
[stm32+esp8266 connects to Tencent cloud IOT development platform 3] stm32+esp8266-01s dynamically registers devices on Tencent cloud (at instruction mode) -- with source code
随机推荐
一份假Offer如何盗走了「Axie infinity」5.4亿美元?
Learn about scratch
Ora-01741 and ora-01704
Pycharm basic settings latest version 2022
[experiment sharing] log in to Cisco devices through the console port
Access database query all tables SQL
数据分析系列 之3σ规则/依据拉依达准则来剔除异常值
Interface
【7.5】15. 三数之和
Summary of common methods of object class (September 14, 2020)
Wechat applet development beginner 1
@Configuration注解的详细介绍
[STM32 + esp-12s connect Tencent cloud IOT development platform 1] creation of cloud platform and burning of at firmware
Oracle string sorting
95.(cesium篇)cesium动态单体化-3D建筑物(楼栋)
IDEA 2021.3. X cracking
How to change the formula picture in the paper directly into the formula in word
【实验分享】通过Console口登录到Cisco设备
Stringutils tool class
MySQL架构