Closed GoogleCodeExporter closed 9 years ago
I asked this question on stackoverflow to find an easy to to row standardize a
matrix....
http://stackoverflow.com/questions/8358962/efficiently-row-standardize-a-matrix/
8359856#8359856
You can row standardize lat2SW as follows,
>>> W = pysal.weights.lat2SW()
>>> Wrs = scipy.sparse.spdiags(1./W.sum(1).T, 0, *W.shape) * W
This should be pretty efficient, but there is a way to do this on
construction... Instead of putting 1's on the diagonals put 1/max(cardinality)
and go back and fix the edge cases.
For now lets try the former. Does this need to be an option of lat2SW? A
method in util? or can we just put the snippet in the user guide?
Original comment by schmi...@gmail.com
on 2 Dec 2011 at 5:40
Implemented SO idea on r1077. If we need more sophisticated ways, we can always
re-open but this works fine.
Original comment by dreamessence
on 16 Jan 2012 at 8:06
Original issue reported on code.google.com by
dreamessence
on 1 Dec 2011 at 7:06