| CounterfactualMethod {counterfactuals} | R Documentation |
Base class for Counterfactual Explanation Methods
Description
Abstract base class for counterfactual explanation methods.
Inheritance
Child classes: CounterfactualMethodClassif, CounterfactualMethodRegr
Methods
Public methods
Method new()
Creates a new CounterfactualMethod object.
Usage
CounterfactualMethod$new( predictor, lower = NULL, upper = NULL, distance_function = NULL )
Arguments
predictor(Predictor)
The object (created withiml::Predictor$new()) holding the machine learning model and the data.lower(
numeric()|NULL)
Vector of minimum values for numeric features. IfNULL(default), the element for each numeric feature inloweris taken as its minimum value inpredictor$data$X. If notNULL, it should be named with the corresponding feature names.upper(
numeric()|NULL)
Vector of maximum values for numeric features. IfNULL(default), the element for each numeric feature inupperis taken as its maximum value inpredictor$data$X. If notNULL, it should be named with the corresponding feature names.distance_function(
character(1)|function())
Either the name of an already implemented distance function (currently 'gower' or 'gower_c') or a function having three arguments:x,y, anddata. The function should return adoublematrix withnrow(x)rows and maximumnrow(y)columns.
Method print()
Prints a CounterfactualMethod object.
The method calls a (private) $print_parameters() method which should be implemented by the leaf classes.
Usage
CounterfactualMethod$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
CounterfactualMethod$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.