()
| 60 | |
| 61 | |
| 62 | def 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") |
nothing calls this directly
no test coverage detected