# A Generative Model for Finding Industry-Specific Keywords

Nov 19, 2019

Company descriptions provide a wealth of information regarding a companyβs business model and can be a very useful source of information for finding company peers. However, due to the nature of natural language, certain equivalent concepts can get expressed in many different ways. This can confound peer suggestions and lead to potentially missed peers.

To alleviate this problem, it seems useful to attempt to obtain a list of industry-specific keywords, which can be used to enhance a companyβs description and hopefully overcome differences of expression and meaning when suggesting peers.

Below, we describe a generative statistical model that can be used to find industry-specific keywords, while simultaneously accounting for common/uninformative background words that naturally occur in their descriptions.

Β

**Annotated Latent Beta Allocation (ALBA)- a simpler form of LDA (Latent Dirichlet Allocation)**

**Β **

It assumes that words are generated from unigram language models, either a generic background model *ππ΅πΊ* that each document is allowed to sample from, or an industry-specific model *ππΌ* that only documents pertaining to that industry can sample from. The probability of sampling from either the background model or the industry model is given by a document-specific parameter *ππ*. It is a single number indicating, for a document *π*, the probability that we sample a word from the background model or the industry specific model.

Therefore, to generate a document *π*, we first sample *ππ* from some Beta prior parametrised by *πΌ*. Then, for each word *π€*, we flip a biased coin whose chance of success is *ππ*, obtaining an indicator *π§π€*. Then if *π§π€* is zero, we sample a word from *ππ΅πΊ*, else we sample a word from *ππ*[*π*], where *π*[*π*] indicates which industry *π* belongs to. We proceed in this fashion until weβve sampled all words. Note that this model is very similar to the popular LDA algorithm.

In plate notation, the algorithm would look as follows:

Inference

The above model is fairly simple and we can immediately do inference on it using e.g. MCMC. However, given the volume of data we have and the fact that MCMC loses all guarantees of stationarity if trained in a mini-batch fashion, we elected to use variational inference for it. As will be shown below, careful treatment of the E and M steps can allow us to train this model in an embarrassingly parallel fashion without losing any mathematical guarantees of convergence. We also show an implementation of variational inference and show that it converges to apparently sensible topics on real company data.

We want to maximise the objective *πΏ*=*π*(**π**|*π*,*πΌ*) where *π* is our documents in bag-of-words format and *πΌ* is the prior over *ππ*.

We can do this by using the EM algorithm, where at the E-step we aim to find *π*

such that

is maximised. Where [*π§ππ*=*π‘*] indicates whether word *π* of document *π* comes from *π‘* (which can be either the background model or the industry-specific model), *π* is the size of the vocab, and *πππ’ππ‘π*(*π*) is the count of word *π* in document *π*.

We can assume a factorised form for *π*(**π³**,*π*)=*π*(**π³**)*π*(*π*) and then use the meanfield approximation to compute *π*(**π³**) and *π*(*π*) iteratively.

Thus, we get

, is a beta distribution . We use *πΎππ*(*π‘*) to denote πΌ[*π§ππ*=*π‘*], and can be interpreted as our belief that word *π* of document *π* came from topic *π‘*=0,1, either the background or the industry-specific topic respectively.

Similarly,

Β

Thus, the E-step can be implemented as follows:

Β

Randomly initialise π(π)

While the change in π(π) is >= 1e-5 do:

Β

Update π(π§) for each document and word

Update π(π) for each document

Β

Unsurprisingly, these equations are very similar to vanilla LDA updates.

In the M-step, we use the *π*(**π³**) and *π*(*π*) computed in the E-step to maximise

πΌ*π*(*π§*)*π*(*π*)*π*(**π**,**π**,*π*)

w.r.t. *π*, under the restriction that β*π*=0,V*ππ‘*(*π*)=1 for all *π‘* and *ππ‘*(*π*)β₯0 for all *π* and *π‘*.

Thus, we obtain the following update:

which is in fact identical to vanilla LDA with the exception that sums are over all documents which have a certain industry (e.g. only companies whose industry is automotive will be considered in the above sum when we look at the automotive industry topic). A thing to note is that all documents are considered when weβre estimating the background topic, so it will naturally converge to containing words that exist in all documents.

Back to Blog