msdnet.validate module¶
Module for defining and processing validation sets.
-
class
msdnet.validate.
Validation
[source]¶ Bases:
abc.ABC
Base class for processing a validation set.
-
abstract
validate
(n)[source]¶ Compute validation metrics.
- Parameters
n –
network.Network
to validate with- Returns
True if validation metric is lower than best validation error encountered, False otherwise.
-
abstract
load_dict
(dct)[source]¶ Return a dictionary containing all network variables and parameters.
- Returns
all network variables and parameters
-
abstract
-
class
msdnet.validate.
MetricValidation
(data, keep=True)[source]¶ Bases:
msdnet.validate.Validation
Validation object that computes simple difference metrics.
- Parameters
data – list of
data.DataPoint
objects to validate with.keep – (optional) whether to keep the best, worst, and typical result in memory.
-
errorfunc
(output, target, msk)[source]¶ Error function used for validation.
- Parameters
output – network output image.
target – target image.
mask – mask image to indicate where to compute error function for.
- Returns
error function value.
-
getbest
()[source]¶ Return the input, target, and network output for best result.
- Returns
list of images (input, target, network output)
-
getworst
()[source]¶ Return the input, target, and network output for worst result.
- Returns
list of images (input, target, network output)
-
getmedian
()[source]¶ Return the input, target, and network output for median result.
- Returns
list of images (input, target, network output)
-
validate
(n)[source]¶ Compute validation metrics.
- Parameters
n –
network.Network
to validate with- Returns
True if validation metric is lower than best validation error encountered, False otherwise.
-
class
msdnet.validate.
MSEValidation
(data, keep=True)[source]¶ Bases:
msdnet.validate.MetricValidation
Validation object that uses mean-squared error