Skip to content

np.mat removed in NumPy 2.0+ #65

@mahamat9

Description

@mahamat9

The use of np.mat in nimfa causes an AttributeError when using NumPy 2.0 or later, as np.mat has been removed. This issue occurs in the following files:

  • nimfa/methods/seeding/nndsvd.py
  • nimfa/utils/linalg.py

Steps to reproduce:

Install NumPy 2.0 or later.
Run any code that uses nimfa, such as NMF initialization with Nndsvd.

Error message:

AttributeError: np.mat was removed in the NumPy 2.0 release. Use np.asmatrix instead.

one solution:
Replace all occurrences of np.mat with np.asmatrix in the code source. This change resolves the issue and maintains compatibility with both older and newer versions of NumPy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions