Wraps an ordered chain of Modules, running them via Module::forward_traced to build a real Computatio...
Definition explainer_context.hpp:67
One JSON value: null, a boolean, a number, a string, an array or an object.
Definition json.hpp:22
N-dimensional tensor. Owns its data buffer exclusively; a DeviceBackend* is injected (not owned) – th...
Definition tensor.hpp:29
Stable interface every explainer gets, regardless of type (charter Part 2 SS2).
A small strict JSON value, parser and deterministic writer (RFC 8259).
Definition acquisition_functions.hpp:16
JsonValue ToJson(const AttackResult &result, const AttackOptions &options)
The result as a pulsatrix.attack.v1 document, without the adversarial inputs.
ContrastiveResult FindPertinentPositive(ExplainerContext &ctx, const Tensor &input, const ContrastiveOptions &options={})
The pertinent positive of input: the least of it that the model still gives its class.
ContrastiveResult FindPertinentNegative(ExplainerContext &ctx, const Tensor &input, const ContrastiveOptions &options={})
The pertinent negative of input: what would have to be added, where the input has nothing,...
CEM's settings. The defaults are the paper's MNIST settings, scaled to its 1,000 steps.
Definition contrastive.hpp:34
float kappa
The margin κ the class change (or keep) must reach in the outputs.
Definition contrastive.hpp:36
std::vector< float > upper
The most a pertinent negative may raise each feature to; empty for no limit.
Definition contrastive.hpp:49
float c_init
The first weight c of the prediction loss; the binary search moves it.
Definition contrastive.hpp:40
int steps
FISTA iterations in each round.
Definition contrastive.hpp:44
float beta
The L1 weight β: larger gives sparser explanations.
Definition contrastive.hpp:38
float learning_rate
Definition contrastive.hpp:45
std::vector< float > baseline
Each feature's absence value; empty for 0.
Definition contrastive.hpp:47
int search_steps
Rounds of the binary search over c.
Definition contrastive.hpp:42
A pertinent negative or positive.
Definition contrastive.hpp:53
bool found
Whether one was found. When not, the other fields describe the input unchanged.
Definition contrastive.hpp:55
int64_t explanation_class
The class of the explanation: another class for a pertinent negative, the same one for a pertinent po...
Definition contrastive.hpp:60
int64_t original_class
The model's class for the input.
Definition contrastive.hpp:57
float c
The weight c of the explanation returned.
Definition contrastive.hpp:69
std::vector< float > delta
δ, one value per feature.
Definition contrastive.hpp:62
std::vector< int64_t > features
Definition contrastive.hpp:67
std::vector< float > explanation
What the model sees: x + δ for a pertinent negative, b + δ for a pertinent positive.
Definition contrastive.hpp:64
double l1
|δ|_1, and the features δ changes.
Definition contrastive.hpp:66
N-dimensional tensor – owns a buffer via DeviceBackend*, RAII (Rule of Five).