# Predictive Fraud Analysis Applying the Fraud Triangle Theory through Data Mining Techniques
## 2 Materials and Methods
### Topic Modeling (TM)
#### 2.2.3 Latent Dirichlet Allocation (LDA)  
LDA is an unsupervised probabilistic generative model that allows finding the semantic structure of a corpus. LDA is based on the hierarchical Bayesian analysis of texts [34]. An LDA model considers several themes in a corpus and a document as a bag of words generated from these themes. In LDA, each document is modeled as a random mix of latent topics. In turn, each topic is characterized as a probability distribution over words; that is, each vocabulary word has a certain probability, where words with high probability are more associated with that topic than words with low probability [35].  
A word is defined as a basic unit of discrete information, which will be part of a vocabulary that we can denote as \(\{w_{1},w_{2},\ldots,w_{V}\}\). A document is a sequence of words represented by \(\{w_{1},w_{2},\ldots,w_{N}\}\), where \(N\) denotes the number of words present in the document. A corpus \(D=\{d_{1},d_{2},\ldots,d_{M}\}\) is a collection of documents that includes the texts on which the topic analysis is to be carried out, and \(M\) is the number of documents in the corpus. The \(K\) topics present in the corpus are represented by the vector \(\beta\). The \(k\) topic (i.e., \(\beta_{k}\)) can be considered a distribution over the vocabulary. To the presence of the \(k\)th topic in a particular document \(d\), we call it \(\theta_{d:k}\). The assignments of a word \(n\) of a document \(d\) in a specific topic are denoted as \(z_{d,n}\). Finally, the words observed in a document \(d\) are denoted as \(w_{d}\), and particularly the \(n\)-th word of the document is denoted as \(w_{d,n}\). More formally, Ref. [36] defined these dependencies in the generative process for LDA, which depicts the joint distribution of hidden and observable variables in the model, as can be seen in Equation (1).  
\[\begin{split} p(\beta_{1:K},\theta_{1:D},w_{1:D})\\ =\prod_{k=1}^{K}p(\beta_{k})\prod_{d=1}^{D}p(\theta_{d})\\ \left(\prod_{n=1}^{N}p(z_{d,n}\mid\theta_{d})p\Big{(}w_{d,n}\mid \beta_{1:K,z_{d,n}}\Big{)}\right)\end{split} \tag{1}\]  
Figure 1 illustrates a probabilistic graphical model (PGM), where the conditional dependencies of the different variables involved in the generative process of the LDA algorithm are observed. The white nodes represent latent variables, such as the prevalence of each topic in a document, the assignment of each word in the document to a topic, and the topics themselves. The shaded node represents the unhidden and observable variable.  
The computational problem is to compute the conditional (posterior) distribution of the topic structure, according to Equation (2).  
\[p(\beta_{1:K},\theta_{1:D},z_{1:D}|w_{1:D})=\frac{p(\beta_{1:K},\theta_{1:D}, z_{1:D},w_{1:D})}{p(_{1:D})} \tag{2}\]  
Figure 1: Representation of latent Dirichlet allocation LDA. Hidden nodes are not shaded and represent the proportions of topics, assignments, and topics.  
The numerator is the joint distribution of all the random variables, which can be easily computed for any hidden variables settings. The denominator is the marginal probability of the observations: the probability of seeing the observed corpus under any topic model.