pulsatrix 1.1.0
Loading...
Searching...
No Matches
sensitivity.hpp File Reference

Local sensitivity: one-at-a-time input changes and occlusion (CFS-3). More...

#include <cstdint>
#include <functional>
#include <vector>
#include "pulsatrix/attribution.hpp"
#include "pulsatrix/tensor.hpp"
Include dependency graph for sensitivity.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pulsatrix::SensitivityBounds
 The low and high value to try for every feature of an input (flat order). More...
 
struct  pulsatrix::FeatureSensitivity
 How one feature's low and high value move the output, everything else held fixed. More...
 
struct  pulsatrix::LocalSensitivityResult
 One-at-a-time sensitivity of one output around one input. More...
 

Namespaces

namespace  pulsatrix
 

Functions

SensitivityBounds pulsatrix::DeltaBounds (const Tensor &input, float delta)
 x - delta and x + delta for every feature.
 
SensitivityBounds pulsatrix::ScaledDeltaBounds (const Tensor &input, const std::vector< Tensor > &background, float num_std=1.0f)
 x -/+ num_std standard deviations of each feature over background, so every feature moves by a comparable amount whatever its units. A feature constant over the background doesn't move.
 
SensitivityBounds pulsatrix::RangeBounds (const std::vector< Tensor > &background, float lower_percentile=0.05f, float upper_percentile=0.95f)
 Each feature's lower and upper percentile over background (linear interpolation, as numpy.percentile): the classic tornado-diagram range, a typical low and high value.
 
LocalSensitivityResult pulsatrix::ComputeLocalSensitivity (const std::function< Tensor(const Tensor &)> &predict, const Tensor &input, int64_t target_index, const SensitivityBounds &bounds, const std::vector< int64_t > &features={})
 Sets each feature in turn to its low and then its high bound, leaving the others at the input's values, and records the target output each time.
 
Attribution pulsatrix::Occlusion (const std::function< Tensor(const Tensor &)> &predict, const Tensor &input, int64_t target_index, const std::vector< int64_t > &window, const std::vector< int64_t > &strides, float baseline=0.0f)
 Occlusion (Zeiler and Fergus 2014) with Captum 0.9's semantics: a window slides over the input with the given strides, everything under it is set to baseline, and each element's attribution is the drop in the target output, f(x) - f(occluded), averaged over the windows that covered it.
 

Detailed Description

Local sensitivity: one-at-a-time input changes and occlusion (CFS-3).