-
Notifications
You must be signed in to change notification settings - Fork 0
/
zscore.el
32 lines (29 loc) · 883 Bytes
/
zscore.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(load-file "matrix.el")
(defun mean (row-vector)
"Get the mean of the elements of data"
(let ((sum-length
(reduce
(lambda (sum-length new-value)
(let ((sum (first sum-length))
(length (second sum-length)))
(list
(+ sum new-value)
(+ length 1))))
data
:initial-value (list 0 0))))
(/ (first sum-length)
(second sum-length))))
(defun mean (data)
"Get the mean of the elements of data"
(let ((sum-length
(reduce
(lambda (sum-length new-value)
(let ((sum (first sum-length))
(length (second sum-length)))
(list
(+ sum new-value)
(+ length 1))))
data
:initial-value (list 0 0))))
(/ (first sum-length)
(second sum-length))))