# How does the naive Bayes classifier handle missing data in testing?

Assume that a classier has been trained already (no missing training data), but a prediction has been requested based on an observation that does not include every feature. How can we handle this missing feature?

In evaluation (test) phase, when data point $$x_n$$ has $$d$$ missing features at indices $$M=\{m_1,...,m_d\}$$, corresponding terms $$P(x_i|C_k),i \in M$$ are simply removed from the classifier. That is, classifier $$C(x_n) = \underset{k \in \{1,..,K\}}{\mbox{argmax }}P(C_k)\prod_{i}P(x_i=x_{n,i}|C_k)$$ is replaced with $$C(x_n) = \underset{k \in \{1,..,K\}}{\mbox{argmax }}P(C_k)\prod_{\color{blue}{i:i \notin M}}P(x_i=x_{n,i}|C_k)$$
where $$i$$ iterates over features, $$x_{n,i}$$ denotes the $$i$$-th feature of data point $$n$$, and there is $$K$$ classes in total.