나는이 알고리즘을 question에 대한 답으로 보았습니다.표준 편차 증명을위한 온라인 알고리즘
표준 편차를 올바르게 계산합니까? 누군가가 수학적으로 왜이 원리를 통해 나를 걸을 수 있습니까? 바람직하게는이 공식에서 다시 작업 :
public class Statistics {
private int n;
private double sum;
private double sumsq;
public void reset() {
this.n = 0;
this.sum = 0.0;
this.sumsq = 0.0;
}
public synchronized void addValue(double x) {
++this.n;
this.sum += x;
this.sumsq += x*x;
}
public synchronized double calculateMean() {
double mean = 0.0;
if (this.n > 0) {
mean = this.sum/this.n;
}
return mean;
}
public synchronized double calculateStandardDeviation() {
double deviation = 0.0;
if (this.n > 1) {
deviation = Math.sqrt((this.sumsq - this.sum*this.sum/this.n)/(this.n-1));
}
return deviation;
}
}
빙고. 숫자 안정성을 염두에두기 시작하면 2 단계 업데이트를 수행 할 수 있습니다. 케이 바르에서 얻을 수있는 (K + 1) 바르 K + 1 K 추가, (X K + 1 - 무 K)는 제곱의 합을 얻을 수 있도록 2는 업데이 트를 해결 옛날이 아닌 새로운 평균과의 차이점. – tmyklebu
위키 피 디아 페이지에서 어떻게 이것을 놓쳤는 지 잘 모르겠지만 이것은 완전히 의미가 있습니다. 감사! – kingbob939