Meters¶
Meters are used to accumulate values over time or batch and generally provide some statistical measure of your process.
APMeter¶
-
class
pywick.meters.apmeter.
APMeter
[source]¶ Bases:
pywick.meters.meter.Meter
The APMeter measures the average precision per class.
The APMeter is designed to operate on NxK Tensors output and target, and optionally a Nx1 Tensor weight where (1) the output contains model output scores for N examples and K classes that ought to be higher when the model is more convinced that the example should be positively labeled, and smaller when the model believes the example should be negatively labeled (for instance, the output of a sigmoid function); (2) the target contains only values 0 (for negative examples) and 1 (for positive examples); and (3) the weight ( > 0) represents weight for each sample.
-
add
(output, target, weight=None)[source]¶ Add a new observation
- Args:
- output (Tensor): NxK tensor that for each of the N examples
- indicates the probability of the example belonging to each of the K classes, according to the model. The probabilities should sum to one over all classes
- target (Tensor): binary NxK tensort that encodes which of the K
- classes are associated with the N-th input (eg: a row [0, 1, 0, 1] indicates that the example is associated with classes 2 and 4)
- weight (optional, Tensor): Nx1 tensor representing the weight for
- each example (each weight > 0)
-
AUCMeter¶
-
class
pywick.meters.aucmeter.
AUCMeter
[source]¶ Bases:
pywick.meters.meter.Meter
The AUCMeter measures the area under the receiver-operating characteristic (ROC) curve for binary classification problems. The area under the curve (AUC) can be interpreted as the probability that, given a randomly selected positive example and a randomly selected negative example, the positive example is assigned a higher score by the classification model than the negative example.
The AUCMeter is designed to operate on one-dimensional Tensors output and target, where (1) the output contains model output scores that ought to be higher when the model is more convinced that the example should be positively labeled, and smaller when the model believes the example should be negatively labeled (for instance, the output of a signoid function); and (2) the target contains only values 0 (for negative examples) and 1 (for positive examples).
AverageMeter¶
AverageValueMeter¶
ClassErrorMeter¶
ConfusionMeter¶
-
class
pywick.meters.confusionmeter.
ConfusionMeter
(k, normalized=False)[source]¶ Bases:
pywick.meters.meter.Meter
Maintains a confusion matrix for a given classification problem.
The ConfusionMeter constructs a confusion matrix for a multi-class classification problems. It does not support multi-label, multi-class problems: for such problems, please use MultiLabelConfusionMeter.
Parameters: - (int) (k) – number of classes in the classification problem
- (boolean) (normalized) – Determines whether or not the confusion matrix is normalized or not
-
add
(predicted, target)[source]¶ Computes the confusion matrix of K x K size where K is no of classes
Parameters: - (tensor) (target) – Can be an N x K tensor of predicted scores obtained from the model for N examples and K classes or an N-tensor of integer values between 0 and K-1.
- (tensor) – Can be a N-tensor of integer values assumed to be integer values between 0 and K-1 or N x K tensor, where targets are assumed to be provided as one-hot vectors
MAPMeter¶
-
class
pywick.meters.mapmeter.
mAPMeter
[source]¶ Bases:
pywick.meters.meter.Meter
The mAPMeter measures the mean average precision over all classes.
The mAPMeter is designed to operate on NxK Tensors output and target, and optionally a Nx1 Tensor weight where (1) the output contains model output scores for N examples and K classes that ought to be higher when the model is more convinced that the example should be positively labeled, and smaller when the model believes the example should be negatively labeled (for instance, the output of a sigmoid function); (2) the target contains only values 0 (for negative examples) and 1 (for positive examples); and (3) the weight ( > 0) represents weight for each sample.
Meter¶
MovingAverageValueMeter¶
MSEMeter¶
TimeMeter¶
-
class
pywick.meters.timemeter.
TimeMeter
(unit)[source]¶ Bases:
pywick.meters.meter.Meter
This meter is designed to measure the time between events and can be used to measure, for instance, the average processing time per batch of data. It is different from most other meters in terms of the methods it provides:
Mmethods:
- reset() resets the timer, setting the timer and unit counter to zero.
- value() returns the time passed since the last reset(); divided by the counter value when unit=true.