modulation.classification.metrics.lwlrap.lwlrap_accumulator

class modulation.classification.metrics.lwlrap.lwlrap_accumulator[source]

Bases: object

Accumulate batches of test samples into per-class and overall lwlrap.

__init__()[source]

Methods

__init__()

accumulate_samples(batch_truth, batch_scores)

Cumulate a new batch of samples into the metric.

overall_lwlrap()

Return the scalar overall lwlrap for cumulated samples.

per_class_lwlrap()

Return a vector of the per-class lwlraps for the accumulated samples.

per_class_weight()

Return a normalized weight vector for the contributions of each class.

accumulate_samples(batch_truth, batch_scores)[source]

Cumulate a new batch of samples into the metric.

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

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

overall_lwlrap()[source]

Return the scalar overall lwlrap for cumulated samples.

per_class_lwlrap()[source]

Return a vector of the per-class lwlraps for the accumulated samples.

per_class_weight()[source]

Return a normalized weight vector for the contributions of each class.