12.03.2016 Views

Anomaly Detection for Monitoring

anomaly-detection-monitoring

anomaly-detection-monitoring

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

this.stddev = function() {<br />

var mean = this.mean();<br />

return Math.sqrt(this.sos/this.points.length - mean*mean);<br />

}<br />

}<br />

var window = new fixedWindow(5);<br />

window.push(1);<br />

window.push(5);<br />

window.push(9);<br />

console.log(window);<br />

console.log(window.mean());<br />

console.log(window.stddev()*3);<br />

EWMA Window<br />

function movingAverage(alpha) {<br />

this.name = 'ewma';<br />

this.ready = true;<br />

function ma() {<br />

this.value = NaN;<br />

this.push = function(newValue) {<br />

if (isNaN(this.value)) {<br />

this.value = newValue;<br />

ready = true;<br />

return;<br />

}<br />

this.value = alpha*newValue + (1 - alpha)*this.value;<br />

};<br />

}<br />

this.MA = new ma(alpha);<br />

this.sosMA = new ma(alpha);<br />

this.push = function(newValue) {<br />

this.MA.push(newValue);<br />

this.sosMA.push(newValue*newValue);<br />

};<br />

this.mean = function() {<br />

return this.MA.value;<br />

};<br />

this.stddev = function() {<br />

return Math.sqrt(this.sosMA.value -<br />

this.mean()*this.mean());<br />

};<br />

}<br />

64 | Appendix A: Appendix

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!