monitor module¶
Monitor¶
A wrapper class for a neural network model which plots fairness metrics with the forward pass.
-
class
monitor.Monitor(model, metrics_dict, groups)¶ Attributes:
modelthe PyTorch Model Monitor is being used withmetric_nameslist of the names of the metrics usedmetric_methodslist of functions to evaluate metrics in the same order as metric_namesgroupslist of the groups of datafigMatplotlib Pyplot figure with subplots of the value of each metric over training steps
-
get_fig()¶ Get fig attribute
Returns: Matplotlib Pyplot figure with subplots corresponding to each metric
-
update_fig(step_no, data, data_groups, labels)¶ Update figure at the end of a foward pass with values of metrics for each group and display the figure Assumes model outputs logits to be fed into softmax activation.
Parameters:
step_nonumber of current training step (e.g. mini-batch number, batch number, epoch number)datavalidation data as list of inputs to modeldata_groupsthe group of each element in data as a 1D arraylabelslabels for each element in data as a 1D array