Learning to Rank Anomalies: Scalar Performance Criteria and Maximization of Two-Sample Rank Statistics