Skip to content

NumPy 1.20 removes np.int causing an error #28

@RiverBreaker

Description

@RiverBreaker

AttributeError: module 'numpy' has no attribute 'int'.

Problem cause
This is due to the use of np.int in the mord library, while NumPy has deprecated and removed the np.int alias in version 1.20 and above, using the native int type of Python instead.

Open the "threshold_based.py" file and find the following code:
"_y = np.array(y).astype(np.int)"
And
"pred = np.sum(tmp < 0, axis=0).astype(np.int)"

Change it to:
"_y = np.array(y).astype(int)"
And
"pred = np.sum(tmp < 0, axis=0).astype(int)"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions