Skip to content

Visualization of zero-one loss in W3D1 tutorial 2 is returning error as aliases of built-in types is deprecated #1168

@ritog

Description

@ritog

As per Numpy's release notes, using the aliases of builtin types like np.int is deprecated.

Yet, it is used in one of the tutorial notebooks. I noticed it.

This is the error message that you see, if you try to visualize Zero-one loss in the interactive demo 3, under section 3.1:

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

Full error message
---------------------------------------------------------------------------

AttributeError                            Traceback (most recent call last)

[/usr/local/lib/python3.11/dist-packages/ipywidgets/widgets/interaction.py](https://localhost:8080/#) in observer(change)
     78         with out:
     79             clear_output(wait=True)
---> 80             f(**kwargs)
     81             show_inline_matplotlib_plots()
     82     for k,w in controls.items():

3 frames

[/usr/local/lib/python3.11/dist-packages/numpy/__init__.py](https://localhost:8080/#) in __getattr__(attr)
    392 
    393         if attr in __former_attrs__:
--> 394             raise AttributeError(__former_attrs__[attr])
    395 
    396         if attr in __expired_attributes__:

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

Here's a screenshot, when Zero-One Loss is selected:

Image

However, it works fine for other losses. One example:

Image

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