where Cw i are the weighted class counts among the k nearest neighbors, W i the class weights computed from class distribution in the training data set and di the mean distance (NCD) between the query point and the k nearest neighbours of class i. The class weights were computed using the function compute class weight from the Python package scikit-learn. For the k nearest-neighbour regression, a simple distance weighted kNN regressor was implemented in the form of