当前位置:网站首页>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
边栏推荐
- archery安装测试
- Take you hand in hand to build Eureka client with idea
- Take you hand in hand to build feign with idea
- Markdown
- Ora-01741 and ora-01704
- Come on, brother
- 【实验分享】通过Console口登录到Cisco设备
- How did a fake offer steal $540million from "axie infinity"?
- Ora-02437 failed to verify the primary key violation
- 数据库面试题+解析
猜你喜欢

Chisel tutorial - 03 Combinatorial logic in chisel (chisel3 cheat sheet is attached at the end)

Anxinco EC series modules are connected to the multi protocol access products of onenet Internet of things open platform

Navicat connects Oracle

数据湖(十五):Spark与Iceberg整合写操作

0-1背包问题

Restricted linear table

95.(cesium篇)cesium动态单体化-3D建筑物(楼栋)

一份假Offer如何盗走了「Axie infinity」5.4亿美元?

SAP HR reward and punishment information export

SAP HR family member information
随机推荐
May day d-light
How to change the formula picture in the paper directly into the formula in word
95.(cesium篇)cesium动态单体化-3D建筑物(楼栋)
507 field D - extraterrestrial relics
HDU - 1260 Tickets(线性DP)
Come on, brother
Pycharm basic settings latest version 2022
Chisel tutorial - 00 Ex.scala metals plug-in (vs Code), SBT and coursier exchange endogenous
HDU - 1260 tickets (linear DP)
Interface
【leetcode】day1
MySQL架构
串联二极管,提高耐压
保证接口数据安全的10种方案
一份假Offer如何盗走了「Axie infinity」5.4亿美元?
Ora-02437 failed to verify the primary key violation
Reverse output three digit and arithmetic sequence
FFA与ICGA造影
Anxinco EC series modules are connected to the multi protocol access products of onenet Internet of things open platform
数据湖(十五):Spark与Iceberg整合写操作