Biterm icon indicating copy to clipboard operation
Biterm copied to clipboard

Index error

Open bee20 opened this issue 7 years ago • 1 comments


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

bee20 avatar Feb 07 '18 00:02 bee20

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

markoarnauto avatar Nov 25 '18 09:11 markoarnauto