[SciPy-user] [newbie] standardize a matrix
Mauro Cherubini
martigan at gmail.com
Tue Oct 11 03:02:18 CDT 2005
Dear All,
sorry for the very basic question I am posing, but I could not find
an exhaustive answer elsewhere ...
I have a symmetrical bi-dimensional array that contains distances
between a certain number of points. The matrix diagoal are all zeros
because of course the distance of a point from self is zero.
I would love to standardize the matrix using one or all of these
methods:
a) divide each attribute distance value of a point by the maximum
observed absolute distance value. This should restrict the values to
lie between -1 and 1. Often the values are all positive, and thus,
all transformed values will lie between 0 and 1.
b) for each distance value subtract off the mean of that distances
and then divide by the distances' standard deviation. If the
distances are normally distributed then most distance values will lie
between -1 and 1.
c) for each distance value subtract off the mean of the distances and
divide by the distances absolute deviation. Typically most distance
values will lie between -1 and 1.
I looked in the SciPy documentation and what I understood is that I
can use an 'ufunc' to define one of these methods. Unfortunately my
knowledge of Python, Numeric and SciPy is very low, so I could not
figure out how. There are very few examples in the documentation at
the moment.
Can anyone point me to a possible implementation or where to look up?
Thanks a lot in advance
Mauro
--
web: http://craft.epfl.ch -- blog: http://www.i-cherubini.it/mauro/blog/
More information about the SciPy-user
mailing list