Add k nearest neighbors method.