当前位置:网站首页>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
边栏推荐
- Understand TCP's three handshakes and four waves with love
- Flash download setup
- Flash encryption process and implementation of esp32
- Pigsty:开箱即用的数据库发行版
- Anti climbing means cracking the second
- Dependency injection
- The file format and extension of XLS do not match
- postgis学习
- 数据湖(十五):Spark与Iceberg整合写操作
- Access database query all tables SQL
猜你喜欢
Take you hand in hand to build Eureka server with idea
Get started with mongodb
蓝桥ROS中使用fishros一键安装
Ora-02437 failed to verify the primary key violation
Chisel tutorial - 04 Control flow in chisel
Anxin can internally test offline voice module vb-01 to communicate with esp-c3-12f
[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
0-1背包问题
Take you hand in hand to build feign with idea
Class C design questions
随机推荐
P1067 [noip2009 popularity group] polynomial output (difficult, pit)
95.(cesium篇)cesium动态单体化-3D建筑物(楼栋)
SQL 使用in关键字查询多个字段
Download AWS toolkit pycharm
Anxin vb01 offline voice module access intelligent curtain guidance
Boost regex library source code compilation
aws-aws help报错
IDEA 2021.3. X cracking
C - minute number V3
串联二极管,提高耐压
What if once again forgets the login password of raspberry pie? And you don't have a monitor yet! Today, I would like to introduce a method
Chisel tutorial - 02 Chisel environment configuration and implementation and testing of the first chisel module
MySQL架构
Anti climbing means cracking the second
通达信买基金安全吗?
2022 certified surveyors are still at a loss when preparing for the exam? Teach you how to take the exam hand in hand?
SAP memory parameter tuning process
C - linear table
codeforces每日5题(均1500)-第八天
Dataguard 主备清理归档设置