pysal / spglm

SParse Generalized Linear Models (spglm)
https://pysal.org/spglm/
BSD 3-Clause "New" or "Revised" License
33 stars 20 forks source link

numpy.float deprecated #34

Closed neoporteria closed 1 year ago

neoporteria commented 1 year ago

numpy.float deprecated, necessary to replace it to float in iwls.py

  File "c:\Users\UCG\git\unmixing_research\src\downscaling\gwrk.py", line 207, in <module>        
    params, lst_cal = GWRK_downscaling(ndvi, lst, block_size,plot_results=True)
  File "c:\Users\UCG\git\unmixing_research\src\downscaling\gwrk.py", line 89, in GWRK_downscaling 
    '    - R2: {}'.format(gwr_results.R2),
  File "C:\Users\UCG\git\unmixing_research\.venv\lib\site-packages\spglm\utils.py", line 358, in __get__
    _cachedval = self.fget(obj)
  File "C:\Users\UCG\git\unmixing_research\.venv\lib\site-packages\mgwr\gwr.py", line 1004, in R2 
    return self.D2
  File "C:\Users\UCG\git\unmixing_research\.venv\lib\site-packages\spglm\utils.py", line 358, in __get__
    _cachedval = self.fget(obj)
  File "C:\Users\UCG\git\unmixing_research\.venv\lib\site-packages\mgwr\gwr.py", line 995, in D2  
    D2 = 1.0 - (self.global_deviance / self.null_deviance)
  File "C:\Users\UCG\git\unmixing_research\.venv\lib\site-packages\spglm\utils.py", line 358, in __get__
    _cachedval = self.fget(obj)
  File "C:\Users\UCG\git\unmixing_research\.venv\lib\site-packages\mgwr\gwr.py", line 983, in null_deviance
    return self.family.deviance(self.y, self.null)
  File "C:\Users\UCG\git\unmixing_research\.venv\lib\site-packages\spglm\utils.py", line 358, in __get__
    _cachedval = self.fget(obj)
  File "C:\Users\UCG\git\unmixing_research\.venv\lib\site-packages\spglm\glm.py", line 342, in null
    return null_mod.fit().mu
  File "C:\Users\UCG\git\unmixing_research\.venv\lib\site-packages\spglm\glm.py", line 132, in fit    params, predy, w, n_iter = iwls(
  File "C:\Users\UCG\git\unmixing_research\.venv\lib\site-packages\spglm\iwls.py", line 111, in iwls
    betas = np.zeros((x.shape[1], 1), np.float)
  File "C:\Users\UCG\git\unmixing_research\.venv\lib\site-packages\numpy\__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
jGaboardi commented 1 year ago

This was fixed in #32