A new globally adaptive k-nearest neighbor classifier based on local mean optimization