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:
model
the PyTorch Model Monitor is being used withmetric_names
list of the names of the metrics usedmetric_methods
list of functions to evaluate metrics in the same order as metric_namesgroups
list of the groups of datafig
Matplotlib 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_no
number of current training step (e.g. mini-batch number, batch number, epoch number)data
validation data as list of inputs to modeldata_groups
the group of each element in data as a 1D arraylabels
labels for each element in data as a 1D array