[@dudani1976distance], a suitable choice of $\alpha_\ell$ is $$\label{12}
    \alpha_\ell(X_i) = \frac{d(v_k,X_i) - d(v_\ell,X_i)}{d(v_k,X_i) - d(v_1,X_i)}\;,$$ where $d(.,.)$ is defined in - and $\alpha_\ell$ is assigned a value of 1 when $d(v_k,X_i) = d(v_1,X_i)$, that is, all the distances are equal. Otherwise, for $k\;(>1)$ neighbors, $0 \leq \alpha_\ell \leq 1$.

Suppose the $j$-th input feature $X_{.j}$ has $S$ possible discrete values with $K_s$ be the number of samples from $\mathscr{V}_{X_i}$ that belong to category $s,\; s = 1,2,...,S$. Now for each possible category, $\alpha_{X_i}^s$ is calculated by $$\label{13}
    \alpha_{X_i}^s = \sum_{\ell=1}^{K_s} \alpha_\ell (X_i).$$ Then, the category $s^*$ imputed to ${\widetilde{X}_{ij}}$ is $$\label{14}
    s^* = \operatorname*{arg\,max}_s \{\alpha_{X_i}^s\}.$$

**Input:** $(X,Y,D)$ with $X \subset \mathbb{R}^{n\times p}$ containing missing entries and $Y$ the class labels. **Output:** Imputed feature matrix $\widetilde{X}$ with no missing values. **Procedure:**

1.  **Initialization:** Given the training dataset $X$, the missing values of $p_0$ categorical features are imputed by mode imputation and the missing values of the $p_1$ continuous features are imputed by mean imputation using the observed data. We call the initially imputed matrix $\widetilde{X}^0$.

2.  **Choosing $k$:** We use this imputed matrix, $\widetilde{X}^0$, to calculate the optimum value of $k$ using 10-fold cross validation [@stone1974cross] to minimize the misclassification rate 