incomplete feature are imputed using mean or mode imputation, depending on the type of feature [@troyanskaya2001missing]. Once its $k$-nearest neighbours have been chosen, the unknown value is imputed by an estimate from the $j$-th feature values of $\mathscr{V}_{X_i}$.

For continuous variables, the imputed value ($\widetilde{X}_{ij}$) is $\widetilde{X}_{ij} = (1/k) \sum_{\ell=1}^k v_{\ell j}$. One obvious refinement is to weight the contribution of each $v_\ell$ according to their distance to $X_i$ [@dudani1976distance], such that $$\label{11}
    \widetilde{X}_{ij} = \frac{1}{kW} \sum_{\ell=1}^k w_\ell\;v_{\ell j}, \quad w_\ell = \frac{1}{{d(X_i,v_\ell)}^2}, \quad W = \sum_{\ell=1}^k w_\ell,$$ where $w_\ell$ denotes the corresponding weight of the $\ell$-th nearest neighbour $v_\ell$ and $d(X_i,v_\ell)$ is as defined in -.

For categorical or discrete variables, we choose among the discrete values of $X_{.j}$. using the values of the $j$-th input features in $\mathscr{V}_{X_i}$. A popular choice is to impute the mode of $\{v_\ell\}_{\ell=1}^k$ to $\widetilde{X}_{ij}$, where all neighbours have the same importance in the imputation stage [@troyanskaya2001missing]. An improvement to this is assigning a weight $\alpha_\ell$ to each $v_\ell$, with closer neighbours having greater weights. The category of $\widetilde{X}_{ij}$ is chosen by the category whose weights sum up to the highest value in $\mathscr{V}_{X_i}$. Using an approach similar to a distance-weighted KNN classifier 