How to detect outliers in an ArrayList

后端 未结 8 989
旧时难觅i
旧时难觅i 2021-01-14 02:54

I\'m trying to think of some code that will allow me to search through my ArrayList and detect any values outside the common range of \"good values.\"

Example: 100 1

8条回答
  •  粉色の甜心
    2021-01-14 03:56

    An implementation of the Grubb's test can be found at MathUtil.java. It will find a single outlier, of which you can remove from your list and repeat until you've removed all outliers.

    Depends on commons-math, so if you're using Gradle:

    dependencies {
      compile 'org.apache.commons:commons-math:2.2'
    }
    

提交回复
热议问题