modulation.classification.metrics.lwlrap.calculate_per_class_lwlrap

modulation.classification.metrics.lwlrap.calculate_per_class_lwlrap(truth, scores)[source]

Calculate label-weighted label-ranking average precision.

Parameters
  • truth – numpy.array of (num_samples, num_classes) giving boolean ground-truth of presence of that class in that sample.

  • scores – numpy.array of (num_samples, num_classes) giving the classifier-under- test’s real-valued score for each class for each sample.

Returns

numpy.array of (num_classes,) giving the lwlrap for each

class.

weight_per_class: numpy.array of (num_classes,) giving the prior of each

class within the truth labels. Then the overall unbalanced lwlrap is simply numpy.sum(per_class_lwlrap * weight_per_class)

Return type

per_class_lwlrap