fix pdist, optimize classifier