module documentation

Validation script to measure and report the classifier's performance.

Subfolders are required to follow the convention: "val/PD" and "val/Control".

Function plot_roc Plot an ROC curve for the given matched and non-matched scores
Function validate Stand the model up and produce validation metrics.
Function _create_dataloader Create a torch 'DataLoader' for the validation data.
Function _t2n Tensor to Numpy When using Torch, converting to Numpy often errors with the need to pass back to CPU first and sometimes additionally detaching explicitly. tolist() does this automatically, and works when exclusively on CPU...
def plot_roc(plt, matched, non_matched, label='ROC', axes=None, steps=1000, verbose=False, max_value=None, return_stats=False):

Plot an ROC curve for the given matched and non-matched scores

Parameters
pltmatplotlib reference object
matched:np.ndarrayA numpy array of matched scores
non_matched:np.ndarrayA numpy array of non-matched scores
labelThe label for the plotted line
axesThe axes to use for the plot; if None, new axes will be made
stepsThe number of steps to use for the plot (# bins)
verboseWhen true, output information about threshold values
max_valueUse this to override the max score to consider
return_statsReturn a dictionary with performance metrics
Returns
The axes used for the plot
def validate(model_file, training_dump_path, batch_size=32):

Stand the model up and produce validation metrics.

Parameters
model_file:strpath to weights (checkpoint) to be loaded (str)
training_dump_path:strBase folder location of the training data
batch_size:intSize of minibatch
Returns
dictoutput data and labels (dict)
def _create_dataloader(training_dump_path, batch_size):

Create a torch 'DataLoader' for the validation data.

Parameters
training_dump_path:strBase folder location of the training data
batch_size:intUndocumented
Returns
torch dataloader
def _t2n(tensor):

Tensor to Numpy When using Torch, converting to Numpy often errors with the need to pass back to CPU first and sometimes additionally detaching explicitly. tolist() does this automatically, and works when exclusively on CPU. So we go to list, then explicity to numpy