Deep learning is usually associated with neural networks.

In this article, we show that **generative classifiers** are also **capable of deep learning**.

**What is deep learning?**

Deep learning is a method of machine learning involving the use of multiple processing layers to learn non-linear functions or boundaries.

**What are generative classifiers?**

Generative classifiers use the Bayes rule to invert probabilities of the features * F* given a class

*into a prediction of the class*

**c***given the features*

**c***.*

**F**The class predicted by the classifier is the one yielding the highest * P(c|F)*.

A commonly used generative classifier is the Naive Bayes classifier. It has two layers (one for the features * F* and one for the classes

*).*

**C****Deep learning using generative classifiers**

The first thing you need for deep learning is a hidden layer. So you add one more layer * H* between the

*and*

**C***layers to get a*

**F****Hierarchical Bayesian classifier**(HBC).

Now, you can compute * P(c|F)* in a

**HBC**in two ways:

The first equation computes * P(c|F)* using a

**product of sums**(POS). The second equation computes

*using a*

**P(c|F)****sum of products**(SOP).

**POS Equation**

We discovered something very interesting about these two equations.

It turns out that if you use the **first equation**, the HBC reduces to a Naive Bayes classifier. Such an HBC **can only learn linear** (or quadratic) decision boundaries.

Consider the discrete **XOR-like function** shown in Figure 1.

There is no way to separate the black dots from the white dots using **one straight line**.

Such a pattern can only be classified 100% correctly by a **non-linear classifier**.

If you train a multinomial Naive Bayes classifier on the data in Figure 1, you get the decision boundary seen in Figure 2a.

Note that the **dotted area** represents the class **1** and the **clear area** represents the class **0**.

It can be seen that no matter what the angle of the line is, at least one point of the four will be misclassified.

In this instance, it is the point at {5, 1} that is misclassified as 0 (since the clear area represents the class 0).

You get the same result if you use a POS HBC.

**SOP Equation**

Our research showed us that something amazing happens if you use the** second equation**.

With the “**sum of products**” equation, the HBC becomes **capable of deep learning**.

**SOP + Multinomial Distribution**

The decision boundary learnt by a **multinomial** non-linear HBC (one that computes the posterior using a sum of products of the hidden-node conditional feature probabilities) is shown in Figure 2b.

The boundary consists of **two straight lines** passing **through the origin**. They are angled in such a way that they separate the data points into the two required categories.

**All four points are classified correctly** since the points at {1, 1} and {5, 5} fall in the clear conical region which represents a classification of 0 whereas the other two points fall in the dotted region representing class 1.

Therefore, the **multinomial** non-linear hierarchical Bayes classifier **can learn** the **non-linear function** of Figure 1.

**Gaussian Distribution**

The decision boundary learnt by a **Gaussian** nonlinear HBC is shown in Figure 2c.

The boundary consists of two quadratic curves separating the data points into the required categories.

Therefore, the **Gaussian** non-linear HBC **can also learn** the **non-linear function** depicted in Figure 1.

**Conclusion**

Since SOP HBCs are multilayered (with **a layer of hidden nodes**), and **can learn non-linear decision boundaries**, they can therefore be said to be **capable of deep learning**.

**Applications to NLP**

It turns out that the multinomial SOP HBC can outperform a number of linear classifiers at certain tasks. For more information, read our paper.

## One thought on “Deep Bayesian Learning for NLP”