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

Possible Bug - Error when creating numpy array out of list of lists having different length #137

Closed
samiul123 opened this issue Nov 28, 2024 · 2 comments · Fixed by #138
Closed

Comments

@samiul123
Copy link

samiul123 commented Nov 28, 2024

When labels are hierarchical and represented as a list of lists and all inner lists don't have equal length, numpy array constructor gives the following error

setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (1781,) + inhomogeneous part.

This happens in HierarchicalClassifier.py at line 164.

Seeing the line at 171, where you are leveling the labels, I wonder if it should be done before converting to numpy array.

image

For Sample data, where Y_train_modifed = [['a'], ['b', 'c']]

This code gives the above error.
lcppn2 = LocalClassifierPerParentNode(local_classifier=model, verbose=1, bert=True) lcppn2.fit(X_train, Y_train_modified)

hi-class version: 4.12.1
numpy version: 1.26.4

@mirand863
Copy link
Collaborator

Hi @samiul123,

Thank you for reporting this issue. I believe I fixed it in PR #138, but please let me know if the issue persists in the new version 4.13.1, which will be released shortly.

@samiul123
Copy link
Author

Hi @mirand863, Thank you so much for fixing the issue. I'll let you know if I find any more problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants