You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from scipy import sparse
import libpysal
import esda
print(libpysal.__version__)
print(esda.__version__)
x = np.array([[1,1],
[0,1]])
y = np.array([[0,1],
[1,1]])
w = np.array([[0,1,1,0],
[1,0,0,1],
[1,0,0,1],
[0,1,1,0]])
sw = sparse.csr_matrix(w)
from esda.lee import Spatial_Pearson
sp = Spatial_Pearson()
sp.fit(x,y)
print(sp.association_)
sp = Spatial_Pearson(sw)
sp.fit(x,y)
print(sp.association_)
The above with pysal version 4.7.0 and esda version 2.5.0 doesn't produce what it ought to. The first fit returns a 4x4 array where the docs say to expect a 2x2. The second crashes with "dimension mismatch" error.
Looking at the code in lee.py I think the x and y inputs need to be flattened. The default connectivity is the unit matrix which is probably never what is required in practice. I'd suggest requiring the user to input the spatial weight matrix as in the moran code.
Cheers,
Rudy
The text was updated successfully, but these errors were encountered:
The above with pysal version 4.7.0 and esda version 2.5.0 doesn't produce what it ought to. The first fit returns a 4x4 array where the docs say to expect a 2x2. The second crashes with "dimension mismatch" error.
Looking at the code in
lee.py
I think the x and y inputs need to be flattened. The default connectivity is the unit matrix which is probably never what is required in practice. I'd suggest requiring the user to input the spatial weight matrix as in the moran code.Cheers,
Rudy
The text was updated successfully, but these errors were encountered: