MCPcopy Index your code
hub / github.com/ddbourgin/numpy-ml / plot_unsmoothed

Function plot_unsmoothed

numpy_ml/plots/lda_plots.py:62–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60
61
62def plot_unsmoothed():
63 corpus, T = generate_corpus()
64 L = LDA(T)
65 L.train(corpus, verbose=False)
66
67 fig, axes = plt.subplots(1, 2)
68 ax1 = sns.heatmap(L.beta, xticklabels=[], yticklabels=[], ax=axes[0])
69 ax1.set_xlabel("Topics")
70 ax1.set_ylabel("Words")
71 ax1.set_title("Recovered topic-word distribution")
72
73 ax2 = sns.heatmap(L.gamma, xticklabels=[], yticklabels=[], ax=axes[1])
74 ax2.set_xlabel("Topics")
75 ax2.set_ylabel("Documents")
76 ax2.set_title("Recovered document-topic distribution")
77
78 plt.savefig("img/plot_unsmoothed.png", dpi=300)
79 plt.close("all")

Callers

nothing calls this directly

Calls 3

trainMethod · 0.95
LDAClass · 0.90
generate_corpusFunction · 0.85

Tested by

no test coverage detected