Icon

LDA, CTM and STM

This workflow is a simple implementation of topic models. Users only need to replace the excel reader node for their own data (e.g., a csv or xls file). The use of pre-processing is optional. Users can select additional text pre-processing nodes if needed.

In the last step users need to configure the Topic Extractor (LDA) node or Topic Extractor (STM) component. A node is different from a component in the sense that the component includes a series of nodes within the component. Please see the node and component descriptions for more details. The LDA node offers an additional measure for model fit (Goodness of Fit component).

The workflow is designed to provide a 2 topic solution, but this option can be changed by users so they identify what is the topic solution (K) that results in greatest model fit and interpretability

If you use this workflow, please cite: Villarroel Ordenes, Francisco, Grant Packard, Davide Proserpio, and Jochen Hartmann, “Using Text Analysis in Service Failure and Recovery: Theory, Workflows, and Models”, Journal of Service Research, Forthcoming.

Simple text pre-processing: 1) exclude punctuation (e.g., "-") as a word, 2) distinguish words because capitalization (e.g., USA same as usa), and 3) remove stop words (a, to, the).

This workflow requires the KNIME extension: textprocessing. The workflow provides 3 alternatives for topic models. Traditional LDA with the Topic Extractor (Parallel LDA node), and more recent topic model algorithms with Topic Extractor (STM) which allows using Correlated Topic Models (CTM) and Structural Topic Models (STM). More details about the STM component below.

The "topic extractor" component integrates with the R implementation of Structural Topic Models (STM), following Roberts, Stewart and Tingley, Journal of Statistical Software (2019) (cran.r-project.org/web/packages/stm/vignettes/stmVignette.pdf), via the R library 'stm' (cran.r-project.org/web/packages/stm).

On its first execution the component is set up to automatically install R and all the required libraries. For this to work you need to install Conda (we recommend via "docs.conda.io/en/latest/miniconda.html"). KNIME Analytics Platform can automatically find the default path of where Conda is installed. You can make sure KNIME Analytics Platform is using the correct path via "File > Preferences > KNIME > Conda".

DISCLAIMER: the "Topic Extractor" component won't work on Apple M1 systems as the 'stm' package is not available for 'osx-arm64' via 'conda-forge' ("anaconda.org/conda-forge/r-stm"). For Apple Intel systems manual installation of additional software might be required after the Conda Environment Propagation node executes. For details visit: docs.knime.com/latest/r_installation_guide

Traditional LDA Model (Mallet Package)

More recent topic model algorithms

Alternativemodel fit
Topic Model Goodness of Fit (χ²)
To implement text processing in KNIME users needto transform stringdata (i.e., text) intoa document typeof column
Strings to Document
Punctuation Erasure
Case Converter
Three output tables: 1) Document-Topic probabilities2) Word-Topic probabilities3) Model fit measures (e.g., coherence)
Topic Extractor (STM)
Excel Reader
Use asmallersampleto fastenprocess
Row Sampling
Visualize Results
Topic Explorer View
Stop Word Filter
Three output tables: 1) Document-Topic probabilities2) Word-Topic probabilities3) Model fit (loglikelihood)
Topic Extractor (Parallel LDA)
Visualization
Topic Explorer View

Nodes

Extensions

Links