A minimum risk for nearest neighbor classification