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

What each explainer answers: the nine question categories (Liao, Gruen and Miller, CHI 2020), the four reasons to explain (Adadi and Berrada, 2018), and a machine-readable declaration of every explainer's question, scope, model access and inputs (XAI-1). More...

#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include "pulsatrix/json.hpp"
Include dependency graph for explainer_capabilities.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pulsatrix::ExplainerCapabilities
 One explainer's declaration: what it answers and what it needs. More...
 

Namespaces

namespace  pulsatrix
 

Enumerations

enum class  pulsatrix::XaiQuestion {
  pulsatrix::Input , pulsatrix::Output , pulsatrix::Performance , pulsatrix::HowGlobal ,
  pulsatrix::Why , pulsatrix::WhyNot , pulsatrix::WhatIf , pulsatrix::HowToBeThat ,
  pulsatrix::HowToStillBeThis
}
 The nine question categories of Liao, Gruen and Miller's XAI question bank (CHI 2020). More...
 
enum class  pulsatrix::XaiReason { pulsatrix::Justify , pulsatrix::Control , pulsatrix::Improve , pulsatrix::Discover }
 Adadi and Berrada's four reasons to explain a model (IEEE Access, 2018). More...
 
enum class  pulsatrix::ExplanationScope { pulsatrix::Local , pulsatrix::Global }
 Whether an explainer explains one prediction or the model as a whole. More...
 
enum class  pulsatrix::ModelAccess {
  pulsatrix::BlackBox , pulsatrix::Weights , pulsatrix::Activations , pulsatrix::Gradients ,
  pulsatrix::Relevance
}
 The least an explainer needs from the model, from least to most access. More...
 
enum class  pulsatrix::InputKind {
  pulsatrix::Any , pulsatrix::Tabular , pulsatrix::Image , pulsatrix::Tokens ,
  pulsatrix::Protein , pulsatrix::Symbolic , pulsatrix::Representation
}
 What the explainer's input has to be. More...
 

Functions

std::string_view pulsatrix::QuestionText (XaiQuestion question)
 The question as Liao et al. phrase it, for example "Why is this instance given this prediction?".
 
std::string_view pulsatrix::ReasonText (XaiReason reason)
 One sentence on the reason.
 
const std::vector< XaiQuestion > & pulsatrix::AllXaiQuestions ()
 All nine questions, in the enum's order.
 
const std::vector< XaiReason > & pulsatrix::AllXaiReasons ()
 All four reasons, in the enum's order.
 
const std::vector< ExplainerCapabilities > & pulsatrix::ExplainerCatalog ()
 Every explainer pulsatrix has, in a fixed order.
 
const ExplainerCapabilities & pulsatrix::ExplainerCapabilitiesOf (std::string_view name)
 The catalog entry named name.
 
std::vector< const ExplainerCapabilities * > pulsatrix::ExplainersFor (XaiQuestion question)
 The explainers that answer question: those that list it first, then the rest, each group in catalog order. Empty for a question pulsatrix has no explainer for yet.
 
JsonValue pulsatrix::ToJson (const ExplainerCapabilities &capabilities)
 The declaration as a JSON object, with the enums as their to_string() names.
 
JsonValue pulsatrix::ExplainerCatalogDocument ()
 The whole catalog: a pulsatrix.explainer_catalog.v1 document.
 
Names. Lower-case snake case, as in reports and JSON: "how_global", "justify".
std::string_view pulsatrix::to_string (XaiQuestion question)
 
std::string_view pulsatrix::to_string (XaiReason reason)
 
std::string_view pulsatrix::to_string (ExplanationScope scope)
 
std::string_view pulsatrix::to_string (ModelAccess access)
 
std::string_view pulsatrix::to_string (InputKind input)
 
Parsing. The inverse of to_string(); std::nullopt for any other text.
std::optional< XaiQuestion > pulsatrix::ParseXaiQuestion (std::string_view text)
 
std::optional< XaiReason > pulsatrix::ParseXaiReason (std::string_view text)
 

Detailed Description

What each explainer answers: the nine question categories (Liao, Gruen and Miller, CHI 2020), the four reasons to explain (Adadi and Berrada, 2018), and a machine-readable declaration of every explainer's question, scope, model access and inputs (XAI-1).

Pulsatrix's explainers are separate classes and free functions with different signatures, so the declarations live in one catalog, ExplainerCatalog(). The classes with an explain() method also return their own entry from a static capabilities().