# Measuring Topic-coherence score & optimal number of topics in LDA Topic Modeling

**URL:** <https://forum.knime.com/t/measuring-topic-coherence-score-optimal-number-of-topics-in-lda-topic-modeling/33325>\
**Category:** KNIME Extensions\
**Tags:** text-processing\
**Created:** [May 30, 2021, 7:52am UTC](https://forum.knime.com/t/measuring-topic-coherence-score-optimal-number-of-topics-in-lda-topic-modeling/33325 "2021-05-30T07:52:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Salah\_Online](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@Salah\_Online](https://forum.knime.com/u/Salah_Online)\
**Post date:** [May 30, 2021, 7:52am UTC](https://forum.knime.com/t/measuring-topic-coherence-score-optimal-number-of-topics-in-lda-topic-modeling/33325/1 "2021-05-30T07:52:39Z")

</div>

Hi KNIMErs… 👋  
I would inquire about how to use KNIME to:

1. Measure (estimate) the optimal (best) number of topics when performing LDA topic modeling (i.e., Topic Extraction), for a large set of text documents (.CSV dataset), using KNIME’s LDA node ⁉.

2. Measuring topic-coherence score in LDA Topic Model in order to evaluate the quality of the extracted topics and their correlation relationships (if any) for extracting useful information ⁉.

Is there a simple way (e.g, ready node or a component) that can accomplish this task ⁉.

The workflow I’m attending to build will be beneficial for academic researchers, who do not necessarily have to be professional coders in R or Python, which are commonly used for such purposes. The topic model is normally used for analyzing large sets of texts corpus, such as scientific articles, in order to discover their trend topics (themes)✅

The following link provides the traditional solution for calculating the topic coherence score using Jupiter-Python as pre-explained✅

[https://towardsdatascience.com/end-to-end-topic-modeling-in-python-latent-dirichlet-allocation-lda-35ce4ed6b3e0](https://towardsdatascience.com/end-to-end-topic-modeling-in-python-latent-dirichlet-allocation-lda-35ce4ed6b3e0)

I assembled the code-cells into a single file attached below:

[Jupiter-Python File:](https://drive.google.com/file/d/1be8rPO3YXRFW3Z5M5C7h4s6rR2zWuT-W/view?usp=sharing)

Looking forward to your suggestions  
Thanks, Knime-community in advance 👍

---

<div class="post-metadata">

**Author:** ![izaychik63](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/i/e9a140/32.png) [@izaychik63](https://forum.knime.com/u/izaychik63)\
**Post date:** [May 30, 2021, 12:11pm UTC](https://forum.knime.com/t/measuring-topic-coherence-score-optimal-number-of-topics-in-lda-topic-modeling/33325/3 "2021-05-30T12:11:11Z")

</div>

Take a look at example

> **[IS Literature Mining with Topic Detection (LDA) – scottf](https://hub.knime.com/scottf/spaces/Public/latest/TextMining_IS_Literature_BoW_LDA~OgrcuCEJMcJE1R43)**
>
> This workflow shows how to extract topics from the input data presented as an Excel file. It uses the Topic Extractor node to identify the dominant topics, and…

and component

> **[Dimensionality Reduction (LDA) – knime](https://hub.knime.com/knime/spaces/Examples/latest/00_Components/Automation/Dimensionality%20Reduction%20(LDA)~eCBjp0QPDRXvzUFA)**
>
> This component reduces the number of columns in the input data by linear discriminant analysis. Linear discriminant analysis is based on separating two or more…

and elbow method for topic extraction

> **[Topic Extraction: Optimizing the Number of Topics with the Elbow Method | KNIME](https://www.knime.com/blog/topic-extraction-optimizing-the-number-of-topics-with-the-elbow-method)**
>
> In a social networking era where a massive amount of unstructured data is generated every day, unsupervised topic modeling has became a very important task i

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [June 2, 2023, 9:40pm UTC](https://forum.knime.com/t/measuring-topic-coherence-score-optimal-number-of-topics-in-lda-topic-modeling/33325/4 "2023-06-02T21:40:27Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
