## 2 Materials and Methods
### Conventional Approach
\[P(x_{i}|X,y)=P(x_{i}|y) \tag{6}\]  
Thus, NB inference and learning models can be obtained from the Bayesian model as follows,  
\[\hat{y}_{k}=\operatorname*{arg\,max}_{k\in\{1,2,\dots,m\}}\left(\frac{P(y_{k} )\prod_{i=1}^{m}P(x_{i}|y_{k})}{P(x_{1},x_{2},\dots,x_{n})}\right) \tag{7}\]  
\[\max(\hat{y})=\operatorname*{arg\,max}_{j\in\{1,2,\dots,l\}}\left(\frac{P(y^ {(j)})\prod_{i=1}^{m}P(x_{i}^{(j)}|y^{(j)})}{P(X^{(j)})}\right) \tag{8}\]  
As an example, consider the sentences from a news corpus:  
1. The weather is worse today due to climate change. 2. The increase in economic crises is due to the pandemic. 3. World leaders are determined to end world crises. 4. Major decisions to end climate change were made by world leaders at the climate summit. 5. During the pandemic, economic activities were shut down, making world leaders struggle with the world economy. 6. No world economy survives the pandemic. 7. World climate change summit discusses how to tackle world climate change crises during a pandemic crisis. 8. Most world leaders don't have a large economy to tackle the pandemic and climate change crises. 9. Without a sustainable economy, it may take longer to survive the pandemic shock. World economic crises and pandemics are headaches to world leaders. After preprocessing the news corpus, consider that the extracted vectorized features and labels are those shown in Table 1. The task is to classify each sentence into Business (B) or Geography (G) news based on the extracted features. Using NB, we first compute the prior of each class, then calculate the likelihoods, and finally estimate the posterior by multiplying the prior with the likelihood since the marginal is fixed. A Laplacian smoothing is used as a normalizer to avoid the probability of zero. A log probability is used to avoid computational underflow (i.e., floating point underflow) in the case of many features. Computing the prior and the likelihood is given as follows  
Class priors: \[\hat{y}=P(y|x_{1},x_{2},\ldots,x_{n})=\frac{P(y)P(x_{1},x_{2},\ldots,x_{n}|y)} {P(x_{1},x_{2},\ldots,x_{n})} \tag{2}\]0 (9) Likelihoods: \[\hat{y}=P(y|x_{1},x_{2},\ldots,x_{n})=\frac{P(y)P(x_{1},x_{2},\ldots,x_{n}|y)} {P(x_{1},x_{2},\ldots,x_{n})} \tag{2}\]1 (10)  
where \(c\) is a class, \(n_{c}\) is the frequency (number of occurrences) of a class, \(n\) is the total occurrences of all the classes, \(w\) is a feature, \(n_{w,c}\) is the frequency (number of occurrences) of a feature given a class \(c\), \(\alpha\) is a smoothing parameter which is equal to 1 for Laplacian smoothing, and \(V\) is the number of vectorized features. There are many variants of NB but the two most popular variants used for text classification are Multinomial NB [16] and Bernoulli NB [17]. For example, using a Bernoulli NB model on Table 1 will require Table 1 be transformed to a binary Bag-of-Words vectorization, as shown in Table 2; then, Equations (9) and (10) will be applied to Table 2 for prior and likelihood estimations, respectively. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline  & \(x_{1}\) & \(x_{2}\) & \(x_{3}\) & \(x_{4}\) & \(x_{5}\) & \(x_{6}\) & \(x_{7}\) & \(\mathbf{y}\) \\ \hline
1 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & G \\
2 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & B \\
3 & 0 & 1 & 1 & 0 & 0 & 1 & 1 & B \\
4 & 0 & 0 & 0 & 2 & 1 & 1 & 1 & G \\
5 & 2 & 0 & 1 & 0 & 0 & 2 & 1 & B \\
6 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & B \\
7 & 0 & 2 & 1 & 2 & 2 & 2 & 0 & G \\
8 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & G \\
9 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & B \\
10 & 1 & 1 & 1 & 0 & 0 & 1 & 1 & B \\ \hline \end{tabular} \(x_{1}\) denotes economy, \(x_{2}\) denotes crises, \(x_{3}\) denotes pandemic, \(x_{4}\) denotes climate, \(x_{3}\) denotes change, \(x_{6}\) denotes world, \(x_{7}\) denotes leader, \(y\) denotes class.  
\end{table} 
Table 2: Binary Bag-of-Words (i.e., 1-gram word) vectorization of a news corpus.