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

Turns a question and a reason into a plan: which explainers can answer the question for this model, ranked, and which checks must run before the answer is trusted (XAI-2). More...

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

Go to the source code of this file.

Classes

struct  pulsatrix::ModelTraits
 What the caller has: the model, its inputs and its data. More...
 
struct  pulsatrix::PlannedCheck
 One check the plan asks for. More...
 
struct  pulsatrix::PlannedExplainer
 One explainer the plan recommends. More...
 
struct  pulsatrix::ExcludedExplainer
 An explainer that answers the question but can't run on this model. More...
 
struct  pulsatrix::ExplanationPlan
 What ExplanationPlanner::plan() returns. More...
 
class  pulsatrix::ExplanationPlanner
 Plans explanations from the explainer catalog. More...
 

Namespaces

namespace  pulsatrix
 

Enumerations

enum class  pulsatrix::CheckPriority { pulsatrix::Required , pulsatrix::Recommended }
 How much a check matters for this reason. More...
 

Functions

std::string_view pulsatrix::to_string (CheckPriority priority)
 
JsonValue pulsatrix::ToJson (const ExplanationPlan &plan)
 The plan as a pulsatrix.explanation_plan.v1 document. Each explainer appears by name, with its header and entry points, so the document stands alone.
 
std::string pulsatrix::DescribePlan (const ExplanationPlan &plan)
 The plan as plain text, for a terminal or a log: the question, the explainers in order with their reasons, the checks, and the warnings.
 

Detailed Description

Turns a question and a reason into a plan: which explainers can answer the question for this model, ranked, and which checks must run before the answer is trusted (XAI-2).

The planner only reads the catalog (explainer_capabilities.hpp); it runs nothing. It is optional: every explainer it names is still called directly, through the entry points in its declaration.

ModelTraits traits;
traits.access = ModelAccess::Relevance; // a pulsatrix network with LRP rules
traits.input = InputKind::Image;
traits.can_reinitialize = true;
const ExplanationPlan plan = ExplanationPlanner().plan(XaiQuestion::Why, XaiReason::Justify, traits);
// plan.explainers.front().capabilities->name: "LRP"
// plan.checks: faithfulness, stability and conservation, each with the call that runs it
std::cout << DescribePlan(plan);