Generalized median computation for consensus learning