有没有更直接或更有效的方法将gensim.interfaces.TransformedCorpus对象中的主题概率数据转换为numpy数组(或者是pandas dataframe)比下面逐行的方法更好?
from gensim import models
import numpy as np
num_topics = 5
model = models.LdaMulticore(corpus, num_topics=num_topics, minimum_probability=0.0)
all_topics = model.get_document_topics(corpus)
num_docs = len(all_topics)
lda_scores = np.empty([num_docs, num_topics])
for i in range(0, num_docs):
lda_scores[i] = np.array(all_topics[i]).transpose()[1]