I am using a python code as a black box that I do not want to touch. The code was working well using Python under Ubuntu 12.04 but after upgrading the system to Ubuntu 16, I got the below warning which interrupt the code from running. Any idea how I can fix this without changing the code? Many thanks.
File "/home/hammouc/.local/lib/python2.7/site-packages/scipy/sparse/base.py", line 849, in todense return np.asmatrix(self.toarray(order=order, out=out))
File "/home/hammouc/.local/lib/python2.7/site-packages/numpy/matrixlib/defmatrix.py", line 71, in asmatrix return matrix(data, dtype=dtype, copy=False)
File "/home/hammouc/.local/lib/python2.7/site-packages/numpy/matrixlib/defmatrix.py", line 123, in new PendingDeprecationWarning, stacklevel=2)
PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
todense
is triggering this. The ideal is to replace this with atoarray
method call. – hpauljnumpy
andscipy
versions are you using? I know we discourage the use ofnp.matrix
, but I wasn't aware of any actual move toward deprecation. – hpaulj