Implemented KNN_purity callback

3 jobs for master in 60 minutes and 35 seconds