weighted knn predictor and abnormal detector in python