Finds the minimal change in FPC scores needed to achieve a target prediction value. For logistic models, uses gradient-based optimization to find the class-flipping counterfactual.
Usage
fregre.counterfactual(
model,
data,
observation,
target.value = NULL,
max.iter = 100,
step.size = 0.1
)Arguments
- model
A fitted
fregre.lmorfregre.logisticmodel.- data
An fdata object.
- observation
Index of the observation (1-based).
- target.value
Target prediction value (for lm models).
- max.iter
Maximum iterations for logistic counterfactual (default 100).
- step.size
Step size for logistic counterfactual (default 0.1).