How to use the std function from mathjs

Find comprehensive JavaScript mathjs.std code examples handpicked from public code repositorys.

90
91
92
93
94
95
96
97
98
99
stats.push(values);

return {
  codeSize: rs[0].codeSize,
  memorySize: rs[0].memorySize,
  stddev: math.std(values),
  mean: math.mean(values),
  median: math.median(values),
  '95%-tile': stats.percentile(95),
  '99%-tile': stats.percentile(99)
fork icon6
star icon32
watch icon3

+ 11 other calls in file

161
162
163
164
165
166
167
168
169
170
        ]
    ),
    3
);
const stddev = math.round(
    math.std(
        benchmarkMetricsCollection[
            key
        ]
    ),
fork icon70
star icon24
watch icon16

+ 454 other calls in file

165
166
167
168
169
170
171
172
173
174
  keys.platforms[results[h].platform['short-name']] = true
  keys.environments[results[h].environment['short-name']] = true
  keys['input-sizes'][results[h].experiment['input-size']] = true

  results[h]['mean-time'] = math.mean(results[h].times)
  results[h]['std-time'] = math.std(results[h].times)
  results[h]['max-time'] = math.max(results[h].times)
  results[h]['min-time'] = math.min(results[h].times)
  a.push(results[h])
}
fork icon6
star icon4
watch icon7

+ 5 other calls in file

65
66
67
68
69
70
71
72
73
74
math.quantileSeq([1, 2, 3, 4, 5], .5) // value at quantile

math.mean(numbers);
math.median(numbers);
math.mode(numbers)
math.std(numbers);
math.variance(numbers);
math.sum(numbers);

// probability
fork icon0
star icon3
watch icon0

+ 6 other calls in file

39
40
41
42
43
44
45
46
47
48
	(4-3)²=1
	(1+1)/1=2
*/
console.log('variância sem tendência:', math.variance([2, 4], 'unbiased'));
// desvio padrão: é a raíz quadrada da variância
console.log('desvio padrão:', math.std([2, 4], 'uncorrected'));
// desvio com tendência: é a raíz quadrada da variância com tendência
console.log('desvio com tendência:', math.std([2, 4], 'biased'));
// desvio sem tendência: é a raíz quadrada da variância sem tendência
console.log('desvio sem tendência:', math.std([2, 4], 'unbiased'));
fork icon0
star icon0
watch icon0

+ 8 other calls in file

9
10
11
12
13
14
15
16
17
18
19
20
21
function winsor(percentile, arr) {
    let rv = arr.slice();
    const len = rv.length;


    const mean = m.mean(rv);
    const std = m.std(rv);


    rv = rv.map(v => (v - mean) / std);


    const percentage = percentile / 100 / 2;
fork icon0
star icon0
watch icon0

57
58
59
60
61
62
63
64
  return array.map((obj) => Math.sqrt(obj))
}


exports.getStDeviation = (array) => {
  console.log('[SCILAB] Standard Deviation')
  return math.std(array)
}
fork icon0
star icon0
watch icon0

+ 5 other calls in file

589
590
591
592
593
594
595
596
597
598
get_std_from_pos_value(classnumber) {
  let std_value = 0;
  Object.entries(this.values.xai).forEach(([key, value]) => {
    if (value.hasOwnProperty("target_idx")) {
      if (parseInt(value.target_idx) === classnumber) {
        std_value = math.std(remove_neg_from_list(csv_to_list(value.raw_string)));
      }
    }
  });
  return std_value;
fork icon0
star icon0
watch icon0

+ 5 other calls in file

69
70
71
72
73
74
75
76
77
78
responses.forEach((response) => {
  randUniforms.push(response.data);
});

let average = math.mean(randUniforms);
let stddev = math.std(randUniforms);

var result = {results: []};
randUniforms.forEach((randUniform) => {
    // z-score: z = (x – μ) / σ
fork icon0
star icon0
watch icon0