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

Function mean

website-phishing/utils.js:89–95  ·  view source on GitHub ↗

* Calculate the arithmetic mean of a vector. * * @param {Array} vector The vector represented as an Array of Numbers. * * @returns {number} The arithmetic mean.

(vector)

Source from the content-addressed store, hash-verified

87 * @returns {number} The arithmetic mean.
88 */
89function mean(vector) {
90 let sum = 0;
91 for (const x of vector) {
92 sum += x;
93 }
94 return sum / vector.length;
95};
96
97/**
98 * Calculate the standard deviation of a vector.

Callers 2

stddevFunction · 0.70
normalizeDatasetFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected