Skip to contents

S7 class to define anchors

Generic function calculate coverage of an anchor

Generic function to extend anchors

Generic function to calculate precision of anchors

S7 class to define a predicate

Generic function to calculate the number of rows in a dataset satisfied by an anchor

Usage

anchors(predicates = class_missing)

coverage(x, ...)

extend(x, ...)

precision(x, ...)

predicate(
  feature = class_missing,
  operator = class_missing,
  constant = class_missing
)

satisfies(x, ...)

Arguments

predicates

a vector of objects with the S7 class of predicate

x

Object of S7 class anchor

feature

Character. Defines the column that the predicate is applied to

operator

Binary operator that works with the column and the constant given

constant

Value to compare feature with using operator. Can be numeric/character/logical

pred

Object of S7 class predicate

model

a predict function that will provide the predicted labels given a dataset

dist

the function that can be used to generate samples by providing an argument n. Should return a dataframe with proper column names.

n_samples

the number of samples to generate from dist (the perturbation distribution)

data

The dataframe to apply anchors on. Can be one instance or an entire dataset.

Value

Object of S7 class anchors

Numeric. Coverage of anchor

named vector of proportions

A logical vector indicating whether the anchors satisfies data