Adapted knn for Kfold cross-validation both for optimization of parameter k (error rate, resubstitution loss and score) and general classification