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

Index error #1

Open
bee20 opened this issue Feb 7, 2018 · 1 comment
Open

Index error #1

bee20 opened this issue Feb 7, 2018 · 1 comment

Comments

@bee20
Copy link

bee20 commented Feb 7, 2018


IndexError Traceback (most recent call last)
in ()
86 pbd_names = [pbd(doc, True) for doc in btmp]
87
---> 88 Nz, Nwz, Z = gibbs_sampler_LDA(It=20, V=V, B=B, num_topics=num_topics, b=b, alpha=alpha, beta=beta)
89
90 topics = [[dictionary[ident] for ident in np.argsort(-Nwz[:,k])[0:10]] for k in range(num_topics)]

in gibbs_sampler_LDA(It, V, B, num_topics, b, alpha, beta)
28 Nzold = np.copy(Nz)
29 for ibi, bi in enumerate(b):
---> 30 Nwz[bi[0], Z[ibi]] -= 1
31 Nwz[bi[1], Z[ibi]] -= 1
32 Nz[Z[ibi]] -= 1

IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

@markoarnauto
Copy link

change Z = np.zeros(B) to Z = np.zeros(B, dtype=np.int8)

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