I have three feature vectors as :
A = [1,0,1,0,0,0]
B = [0,0,0,1,1,1]
C = [1,1,1,0,1,0]
Is there a python library that can help me compute the std dev of these ?
I have three feature vectors as :
A = [1,0,1,0,0,0]
B = [0,0,0,1,1,1]
C = [1,1,1,0,1,0]
Is there a python library that can help me compute the std dev of these ?
>>> A = [1,0,1,0,0,0]
>>> B = [0,0,0,1,1,1]
>>> C = [1,1,1,0,1,0]
>>> numpy.std(map(numpy.mean,zip(A,B,C)))
0.16666666666666666
>>> map(numpy.mean,zip(A,B,C))
[0.66666666666666663, 0.33333333333333331, 0.66666666666666663, 0.33333333333333331, 0.66666666666666663, 0.33333333333333331]
You can use numpy.std
for population standard deviation:
>>> [numpy.std(arr) for arr in (A, B, C)]
[0.47140452079103168, 0.5, 0.47140452079103168]
However, if you want to stick to built-in modules (and have Python v3.4+), you could check out the functions pstdev
and stdev
in the statistics
module to calcultae population standard deviation and sample standard deviation respectively.