libpysal.weights.
WSP
(sparse, id_order=None)[source]¶Thin W class for spreg.
Parameters: |
|
---|
Examples
From GAL information
>>> import scipy.sparse
>>> from libpysal.weights import WSP
>>> rows = [0, 1, 1, 2, 2, 3]
>>> cols = [1, 0, 2, 1, 3, 3]
>>> weights = [1, 0.75, 0.25, 0.9, 0.1, 1]
>>> sparse = scipy.sparse.csr_matrix((weights, (rows, cols)), shape=(4,4))
>>> w = WSP(sparse)
>>> w.s0
4.0
>>> w.trcWtW_WW
6.395
>>> w.n
4
Attributes: |
|
---|
Methods
from_W (W) |
Constructs a WSP object from the W’s sparse matrix |
to_W ([silence_warnings]) |
Convert a pysal WSP object (thin weights matrix) to a pysal W object. |
__init__
(sparse, id_order=None)[source]¶Initialize self. See help(type(self)) for accurate signature.
Methods
__init__ (sparse[, id_order]) |
Initialize self. |
from_W (W) |
Constructs a WSP object from the W’s sparse matrix |
to_W ([silence_warnings]) |
Convert a pysal WSP object (thin weights matrix) to a pysal W object. |
Attributes
diagWtW_WW |
Diagonal of \(W^{'}W + WW\). |
s0 |
s0 is defined as: |
trcWtW_WW |
Trace of \(W^{'}W + WW\). |