anchors: Create a model explanation function based on training data

Description Usage Arguments Value

View source: R/anchors.R

Description

This is the main function of the 'anchors' package. It is a factory function that returns a new function that can be used to explain the predictions made by black box models. This is a generic with methods for the different data types supported by anchors.

For this, a model and a perturbation space is required. To construct the perturbation space, a training set is used. Also, discretization can be defined to increase explanation quality.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
anchors(x, model, perturbator = NULL, bins = NULL, p = 0.5,
  coverage_perturbation_count = 1000, target = NULL,
  maxAnchors = NULL, beams = 2L, delta = 0.1, epsilon = 0.1,
  tau = 0.9, tauDiscrepancy = 0.05, initSamples = 10L,
  allowSuboptimalSteps = TRUE, batchSize = 100L, verbose = FALSE,
  ...)

## S3 method for class 'data.frame'
anchors(x, model, perturbator = NULL, bins = NULL,
  p = 0.5, coverage_perturbation_count = 1000, target = NULL,
  maxAnchors = NULL, beams = 2L, delta = 0.1, epsilon = 0.1,
  tau = 0.9, tauDiscrepancy = 0.05, initSamples = 10L,
  allowSuboptimalSteps = TRUE, batchSize = 100L, verbose = 0, ...)

Arguments

x

The training data used for training the model that should be explained.

model

The model whose output should be explained

perturbator

Pertubator to perturbate the instances to be explained.

bins

the discretization bins

p

the perturbation probability(?)

coverage_perturbation_count

? TODO

target

Target column in [x]. Provide this if model is not of class "WrappedModel".

maxAnchors

how many features can be maximal anchored?

beams

size of the current candidates for beam search

delta

The delta value describing the probability of identifying the best arm == confidence

epsilon

The maximum tolerated error == tolerance

tau

The desired precision an anchor needs to achieve. If no candidate achieves at least this precision, the one with the best precision will be returned

tauDiscrepancy

Usually, it is practically infeasible to sample until the mean and the upper/lower bounds simultaneously fall below or above the tau threshold. Therefore, this variable may be introduced to control this discrepancy.

initSamples

The number of evaluations sampled for each candidate before it gets evaluated by the best arm identification algorithm. While theoretically, a guarantee that no candidates get discarded due to too few samples is provided by delta, using this argument has practical advantages.

allowSuboptimalSteps

if set to false, candidates that are returned by the best arm identification get removed when their precision is lower than their parent's

batchSize

The number of evaluations to perform on each pull of the arm

verbose

anchors will print abbreviated information and round after 4 digits. Set verbose to 'TRUE' to increase information load. Default: 'FALSE'

...

Arguments passed on to methods

Value

Returns an explainer which can be used together with [explain()] to explain model predictions.


viadee/anchorsOnR documentation built on Nov. 22, 2019, 5:24 p.m.