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

Error converting MicroCluster to numpy array #3

Open
asieriko opened this issue Dec 1, 2024 · 1 comment
Open

Error converting MicroCluster to numpy array #3

asieriko opened this issue Dec 1, 2024 · 1 comment

Comments

@asieriko
Copy link
Contributor

asieriko commented Dec 1, 2024

Hello,

MicroClusters are inhomogeneous structures (lists, integers, ...) so when converting them to numpy array it throws an error:

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (100, 10) + inhomogeneous part.
(FedStream-main/fdstream.py", line 161, in convert_to_numpy)

In order to fix this the following has to be changed:
from:

np.asarray(MicroCluster)

to:

np.asarray(MicroCluster, dtype="object")

Maybe there is some change in the default behaviour in np.asarray

I've found 4 appearances in microcluster.py, and 4 in fdstream.py.

If you are interested I can send you a Pull request.

@mvisionai
Copy link
Owner

@asieriko Thank you for your effort in helping maintain the codebase. You are absolutely right; the issue is caused by changes in behavior in the current numpy versions of np.asarray. I have accepted the pull request. I truly appreciate your contribution to maintaining the codebase.

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

No branches or pull requests

2 participants