This is a super class for all data-based interpreting methods. Implemented are the following methods:
Deep Learning Important Features (DeepLift)
Layer-wise Relevance Propagation (LRP)
Gradient-based methods:
Vanilla gradients including 'Gradients x Input' (Gradient)
Smoothed gradients including 'SmoothGrad x Input' (SmoothGrad)
dataThe passed data as a torch tensor in the given data type
(dtype) to be interpreted with the selected method.
converterAn instance of the R6 class Converter.
dtypeThe data type for the calculations. Either 'float'
for torch::torch_float or 'double' for torch::torch_double.
channels_firstThe format of the given date, i.e. channels on
last dimension (FALSE) or after the batch dimension (TRUE). If the
data has no channels, the default value TRUE is used.
ignore_last_actA boolean value to include the last
activation into all the calculations, or not (default: TRUE). In some
cases, the last activation leads to a saturation problem.
resultThe methods result of the given data as a
torch tensor of size (batch_size, dim_in, dim_out) in the given data type
(dtype).
output_idxThis vector determines for which outputs the method
will be applied. By default (NULL), all outputs (but limited to the
first 10) are considered.
new()Create a new instance of this super class.
InterpretingMethod$new( converter, data, channels_first = TRUE, output_idx = NULL, ignore_last_act = TRUE, dtype = "float" )
converterAn instance of the R6 class Converter.
dataThe data for which this method is to be applied. It has to be an array or array-like format of size (batch_size, dim_in).
channels_firstThe format of the given data, i.e. channels on
last dimension (FALSE) or after the batch dimension (TRUE). If the
data has no channels, use the default value TRUE.
output_idxThis vector determines for which output indices the
method will be applied. By default (NULL), all outputs (but limited to
the first 10) are considered.
ignore_last_actA boolean value to include the last
activation into all the calculations, or not (default: TRUE). In
some cases, the last activation leads to a saturation problem.
dtypedtype The data type for the calculations. Use
either 'float' for torch::torch_float or 'double' for
torch::torch_double.
get_result()This function returns the result of this method for the given data
either as an array ('array'), a torch tensor ('torch.tensor',
or 'torch_tensor') of size (batch_size, dim_in, dim_out) or as a
data.frame ('data.frame').
InterpretingMethod$get_result(type = "array")
typeThe data type of the result. Use one of 'array',
'torch.tensor', 'torch_tensor' or 'data.frame'
(default: 'array').
The result of this method for the given data in the chosen type.
clone()The objects of this class are cloneable with this method.
InterpretingMethod$clone(deep = FALSE)
deepWhether to make a deep clone.