Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualization: plot_tabular does not work for x as np.ndarray #822

Open
SarahAlidoost opened this issue Jul 10, 2024 · 0 comments
Open

Visualization: plot_tabular does not work for x as np.ndarray #822

SarahAlidoost opened this issue Jul 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@SarahAlidoost
Copy link
Contributor

The input x in plot_tabular is defined as Array of feature importance scores. However, it returns an error if x is np.ndarray. There isnot a test for this in test_visualization.py. You can reproduce the error as:

import numpy as np
def test_plot_tabular_with_array():
    """Test plot tabular data."""
    x = np.random.rand(5, 3)
    y = [f"Feature {i}" for i in range(x.shape[1])]
    fig, ax = plot_tabular(x=x, y=y, show_plot=False)
    assert fig is not None

the error

>       top_values = [x for _, x in sorted(zip(abs_values, x), reverse=True)][:num_features]
E       ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
@SarahAlidoost SarahAlidoost added the bug Something isn't working label Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant