innsight_sugar {innsight} | R Documentation |
Syntactic sugar for object construction
Description
Since all methods and the preceding conversion step in the innsight
package were implemented using R6 classes and these always require a call
to classname$new()
for initialization, the following functions are
defined to shorten the construction of the corresponding R6 objects:
-
convert()
forConverter
-
run_grad()
forGradient
-
run_smoothgrad()
forSmoothGrad
-
run_intgrad()
forIntegratedGradient
-
run_expgrad()
forExpectedGradient
-
run_lrp()
forLRP
-
run_deeplift()
forDeepLift
-
run_deepshap
forDeepSHAP
-
run_cw
forConnectionWeights
-
run_lime
forLIME
-
run_shap
forSHAP
Usage
# Create a new `Converter` object of the given `model`
convert(model, ...)
# Apply the `Gradient` method to the passed `data` to be explained
run_grad(converter, data, ...)
# Apply the `SmoothGrad` method to the passed `data` to be explained
run_smoothgrad(converter, data, ...)
# Apply the `IntegratedGradient` method to the passed `data` to be explained
run_intgrad(converter, data, ...)
# Apply the `ExpectedGradient` method to the passed `data` to be explained
run_expgrad(converter, data, ...)
# Apply the `LRP` method to the passed `data` to be explained
run_lrp(converter, data, ...)
# Apply the `DeepLift` method to the passed `data` to be explained
run_deeplift(converter, data, ...)
# Apply the `DeepSHAP` method to the passed `data` to be explained
run_deepshap(converter, data, ...)
# Apply the `ConnectionWeights` method (argument `data` is not always required)
run_cw(converter, ...)
# Apply the `LIME` method to explain `data` by using the dataset `data_ref`
run_lime(model, data, data_ref, ...)
# Apply the `SHAP` method to explain `data` by using the dataset `data_ref`
run_shap(model, data, data_ref, ...)
Arguments
model |
( |
... |
Other arguments passed to the individual constructor functions of the methods R6 classes. |
converter |
( |
data |
(
Note: For the model-agnostic methods, only models with a single
input and output layer is allowed! |
data_ref |
( |
Value
R6::R6Class object of the respective type.