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

"ValueError: shape mismatch" in antiVectorize of helper.py. I've included my solution in this comment. #2

Open
turingelir opened this issue Jan 5, 2022 · 0 comments

Comments

@turingelir
Copy link

turingelir commented Jan 5, 2022

Bug log:

File "C:\Users\Fatih\DGN-master\config.py", line 61, in
X = helper.create_better_simulated(N_Subjects, N_Nodes) if N_views == 4 else helper.simulate_dataset(N_Subjects, N_Nodes, N_views)
File "C:\Users\Fatih\DGN-master\helper.py", line 18, in create_better_simulated
view1 = np.array([antiVectorize(v, N_ROIs) for v in view1])
File "C:\Users\Fatih\DGN-master\helper.py", line 18, in
view1 = np.array([antiVectorize(v, N_ROIs) for v in view1])
File "C:\Users\Fatih\DGN-master\helper.py", line 77, in antiVectorize
M[np.tril_indices(m,k=-1)] = vec
ValueError: shape mismatch: value array of shape (630,) could not be broadcast to indexing result of shape (595,)

My solution:

def antiVectorize(vec, m):
    il = np.tril_indices(m, k=0)

    M = np.zeros((m, m))
    M[il] = vec
    M = M.T
    M[il] = vec
    M[np.diag_indices(m)] = 0

    return M
@turingelir turingelir changed the title "ValueError: shape mismatch" in antiVectorize of helper.py. I've attached my solution. "ValueError: shape mismatch" in antiVectorize of helper.py. I've included my solution in this comment. Jan 5, 2022
@turingelir turingelir reopened this Jan 5, 2022
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

1 participant