MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / stddev

Function stddev

polynomial-regression/index.js:85–92  ·  view source on GitHub ↗
(vector)

Source from the content-addressed store, hash-verified

83// Returns:
84// The standard deviation.
85function stddev(vector) {
86 let squareSum = 0;
87 const vectorMean = mean(vector);
88 for (const x of vector) {
89 squareSum += (x - vectorMean) * (x - vectorMean);
90 }
91 return Math.sqrt(squareSum / (vector.length - 1));
92}
93
94// Normalize a vector by its mean and standard deviation.
95function normalizeVector(vector, vectorMean, vectorStddev) {

Callers 1

toNormalizedTensorsFunction · 0.70

Calls 1

meanFunction · 0.70

Tested by

no test coverage detected