computing z-scores for 2D matrices in scipy/numpy in Python
- by user248237
How can I compute the z-score for matrices in Python?
Suppose I have the array:
a = array([[ 1, 2, 3],
[ 30, 35, 36],
[2000, 6000, 8000]])
and I want to compute the z-score for each row. The solution I came up with is:
array([zs(item) for item in a])
where zs is in scipy.stats.stats. Is there a better built-in vectorized way to do this?
Also, is it always good to z-score numbers before using hierarchical clustering with euclidean or seuclidean distance? Can anyone discuss the relative advantages/disadvantages?
thanks.