added kNN learning code