1. A classification method comprising: with a processor, for a new sample to be classified, for each of a set of classes, computing a probability for each class based on a comparison measure between a multidimensional representation of the new sample and a respective multidimensional class representation, the comparison measure being computed in a space of lower dimensionality than the multidimensional representation of the new sample by embedding the multidimensional representation of the new sample and the multidimensional class representations with a projection that has been learned on labeled samples to optimize classification of the labeled samples based on the comparison measure, the comparison measure being based on an exponentially decreasing function of a distance between the embedded multidimensional representation of the sample and a respective one of the embedded multidimensional class representations, each multidimensional class representation being computed based on a set of multidimensional representations of labeled samples that are labeled with the respective class; and assigning a class to the new sample based on the computed probabilities.