243 std::string
method =
"partial_dependence";
263 std::string target =
"");
267 std::string target =
"");
305 const std::vector<std::string>& names = {},
306 std::string target =
"");
340 const std::vector<std::string>& names = {},
341 const std::vector<float>& scale = {},
342 std::string target =
"");
382 std::string target =
"");
385 std::string target =
"");
427 std::vector<std::string> groups = {}, std::vector<float> values = {},
428 std::string title =
"");
439 std::vector<std::string> groups = {}, std::vector<float> values = {},
440 std::string title =
"");
First-class explanation result type – values, method, and metadata together.
Self-contained circuit-graph artifact – scored nodes and weighted edges.
A copyable, self-contained circuit graph: every node of one forward pass with an ablation importance ...
Definition circuit_graph.hpp:78
Vendor-agnostic compute/memory backend. CPUBackend, CUDABackend (Phase 1.5), and HIPBackend (Phase 1....
Definition device_backend.hpp:248
A concrete MetricsSink (metrics_sink.hpp's own doc comment names this the expected extension point: "...
Definition implot_metrics_sink.hpp:36
Interface the training loop logs scalars/histograms through. Concrete writers (TensorBoard event form...
Definition metrics_sink.hpp:22
N-dimensional tensor. Owns its data buffer exclusively; a DeviceBackend* is injected (not owned) – th...
Definition tensor.hpp:29
Counterfactual explanations: gradient-based (Wachter et al. 2017, CFS-5) and model-agnostic (growing ...
Abstract interface isolating vendor-specific memory/compute operations from Tensor/ComputationGraph.
Global sensitivity analysis: Morris elementary effects and Sobol indices (CFS-4).
Individual conditional expectation (ICE), its centered and derivative forms, two-feature partial depe...
Concrete MetricsSink that buffers training scalars/histograms for live plotting.
Keeps monitoring/visualization tools out of the training core – same OCP/DIP pattern as DeviceBackend...
Definition acquisition_functions.hpp:16
MorrisDocument ToMorrisDocument(const MorrisResult &result, const std::vector< std::string > &names={}, std::string target="")
names, if not empty, has one name per entry of result.features (the varied features,...
HeatmapDocument ParseHeatmapDocument(std::string_view json)
AttributionDocument ParseAttributionDocument(std::string_view json)
TokenRelevanceDocument ParseTokenRelevanceDocument(std::string_view json)
SobolDocument ParseSobolDocument(std::string_view json)
AttributionDocument ToAttributionDocument(const Attribution &attr)
Copies attr into a document, reading its values to the host.
ProjectionDocument ParseProjectionDocument(std::string_view json)
MorrisDocument ParseMorrisDocument(std::string_view json)
ProjectionDocument MakeProjectionDocument(const Pca &pca, const Tensor &scores, std::vector< std::string > labels={}, std::vector< std::string > groups={}, std::vector< float > values={}, std::string title="")
A projection document from PcaProject()'s scores: axes PC1, PC2, ... with the PCA's explained varianc...
Attribution ToAttribution(const AttributionDocument &doc, DeviceBackend *backend)
Rebuilds an Attribution whose values live on backend.
CounterfactualDocument ToCounterfactualDocument(const Tensor &input, const CounterfactualResult &result, const std::vector< std::string > &names={}, const std::vector< float > &scale={}, std::string target="")
Pairs input with result's counterfactual. names and scale, if not empty, have one entry per feature; ...
PartialDependenceDocument ParsePartialDependenceDocument(std::string_view json)
const char * OpTypeName(OpType op_type)
The name ToCircuitGraphDocument writes for op_type, for example "Linear".
TrainingLogDocument ParseTrainingLogDocument(std::string_view json)
CircuitGraphDocument ToCircuitGraphDocument(const CircuitGraph &graph)
CircuitGraph ToCircuitGraph(const CircuitGraphDocument &doc)
JsonValue ToJson(const AttackResult &result, const AttackOptions &options)
The result as a pulsatrix.attack.v1 document, without the adversarial inputs.
OpType
The op-type tag a Node carries. Charter Part 2 §3: nodes are tagged by a small closed set of op types...
Definition op_type.hpp:19
void ReplayTrainingLog(const TrainingLogDocument &doc, MetricsSink &sink)
Logs every scalar in doc to sink in the order recorded, then every histogram (at step 0,...
IceResult ToIceResult(const PartialDependenceDocument &doc)
Rebuilds the ICE curves for their centered and derivative views.
HeatmapDocument ToHeatmapDocument(const HeatmapGrid &grid, std::string title="")
CircuitGraphDocument ParseCircuitGraphDocument(std::string_view json)
SobolDocument ToSobolDocument(const SobolResult &result, const std::vector< std::string > &names={}, std::string target="")
names, if not empty, has one name per entry of result.features (the varied features,...
SensitivityDocument ParseSensitivityDocument(std::string_view json)
FeatureDashboardDocument ParseFeatureDashboardDocument(std::string_view json)
OpType OpTypeFromName(std::string_view name)
std::string VizDocumentKind(std::string_view json)
Reads only a document's "schema" member and returns its kind (for example "attribution"),...
constexpr int kVizDocumentVersion
The document format version this build writes and reads.
Definition document.hpp:45
HeatmapGrid ToHeatmapGrid(const HeatmapDocument &doc)
bool IsNeighborEmbedding(const ProjectionDocument &doc)
Whether the document's method is UMAP or t-SNE (umap, tsne, t-sne or opentsne, any case),...
PartialDependenceDocument ToPartialDependenceDocument(const IceResult &result, std::string feature="", std::string target="")
Copies result, its partial dependence curve included.
SensitivityDocument ToSensitivityDocument(const LocalSensitivityResult &result, const std::vector< std::string > &names={}, std::string target="")
Copies result. names, if not empty, has one name per input feature (flat index); features without a n...
CounterfactualDocument ParseCounterfactualDocument(std::string_view json)
TrainingLogDocument ToTrainingLogDocument(const ImPlotMetricsSink &sink)
Copies everything sink has logged, sorted by tag.
Principal component analysis of a layer's representations (INT-5): 2D and 3D views,...
Pure Attribution/Dataset -> plot-ready-array transforms (no ImGui/ImPlot include).
Local sensitivity: one-at-a-time input changes and occlusion (CFS-3).
First-order accumulated local effects (Apley and Zhu 2020) of one feature.
Definition ice.hpp:120
pulsatrix.attribution.v1: an Attribution's values, shape, method and metadata.
Definition document.hpp:58
std::vector< float > values
Row-major values.
Definition document.hpp:63
std::vector< int64_t > shape
The values' tensor shape; values has the product of these many elements.
Definition document.hpp:61
std::string method
Definition document.hpp:59
std::map< std::string, std::string > metadata
Written with keys sorted, so a document doesn't depend on hash-map order.
Definition document.hpp:65
An explanation result: the raw attribution values, the method that produced them, and any relevant me...
Definition attribution.hpp:23
Definition document.hpp:143
float weight
Definition document.hpp:146
int64_t from
Definition document.hpp:144
int64_t to
Definition document.hpp:145
Definition document.hpp:136
float ablation_effect
Definition document.hpp:141
std::optional< std::string > label
Definition document.hpp:140
std::string op_type
The OpType's name, for example "Linear".
Definition document.hpp:139
pulsatrix.circuit_graph.v1: a CircuitGraph's scored nodes and weighted edges.
Definition document.hpp:135
std::vector< Edge > edges
Definition document.hpp:149
std::vector< Node > nodes
Definition document.hpp:148
Definition document.hpp:322
float original
Definition document.hpp:324
float counterfactual
Definition document.hpp:325
float scale
The distance scale (a change of scale costs 1), positive.
Definition document.hpp:327
std::string name
Definition document.hpp:323
pulsatrix.counterfactual.v1: an input, its counterfactual, and what reaching the target cost (CFS-5).
Definition document.hpp:316
float output_after
Definition document.hpp:321
bool valid
Definition document.hpp:319
std::string target
The goal, for example "class approved" or "price in [200, 250]". Optional.
Definition document.hpp:318
std::vector< Feature > features
Every feature, changed or not, in input order.
Definition document.hpp:330
float output_before
Definition document.hpp:320
A counterfactual and how good it is (the DiCE metrics, for one counterfactual).
Definition counterfactual.hpp:72
Definition document.hpp:214
std::string label
Where the example came from, for example a dataset index.
Definition document.hpp:216
std::vector< float > activations
The feature's activation per token, or a single value for a non-text input.
Definition document.hpp:220
std::vector< std::string > tokens
Token texts for a text example; empty for any other input.
Definition document.hpp:218
pulsatrix.feature_dashboard.v1: one learned feature (for example a sparse autoencoder unit) with its ...
Definition document.hpp:204
float activation_density
The fraction of inputs on which the feature is active, in [0, 1].
Definition document.hpp:209
std::vector< int64_t > histogram_counts
Definition document.hpp:213
std::vector< float > histogram_edges
Activation histogram: bin edges (one more than counts), or both empty.
Definition document.hpp:212
std::string source
Where the feature lives, for example "sae.blocks.3".
Definition document.hpp:206
int64_t feature_index
Definition document.hpp:207
float max_activation
Definition document.hpp:210
std::vector< Example > top_examples
Strongest first.
Definition document.hpp:223
pulsatrix.heatmap.v1: a row-major grid of values with optional axis labels.
Definition document.hpp:79
int64_t cols
Definition document.hpp:82
std::vector< float > values
Definition document.hpp:83
std::vector< std::string > row_labels
Empty, or one label per row.
Definition document.hpp:85
std::vector< std::string > col_labels
Empty, or one label per column.
Definition document.hpp:87
std::string title
Definition document.hpp:80
int64_t rows
Definition document.hpp:81
A row-major 2D grid of unsigned magnitude values, ready for a heatmap plot.
Definition plot_data.hpp:85
ICE curves for one feature: curves[i][k] = f(x_i with feature j set to grid[k])[target].
Definition ice.hpp:41
One-at-a-time sensitivity of one output around one input.
Definition sensitivity.hpp:60
Definition document.hpp:354
float mu_star
Definition document.hpp:357
float mu_star_conf
Definition document.hpp:359
float mu
Definition document.hpp:356
std::string name
Definition document.hpp:355
float sigma
Definition document.hpp:358
pulsatrix.morris.v1: Morris screening statistics per feature (CFS-4).
Definition document.hpp:350
int64_t num_trajectories
Definition document.hpp:353
std::vector< Feature > features
Definition document.hpp:361
std::string target
What the output is. Optional.
Definition document.hpp:352
Morris screening results, one entry per varied feature (SALib's morris.analyze).
Definition global_sensitivity.hpp:31
Partial dependence on two features at once, over a grid of value pairs.
Definition ice.hpp:86
pulsatrix.partial_dependence.v1: a partial dependence curve over one feature, with the individual (IC...
Definition document.hpp:239
std::string target
What the curve predicts, for example a class name. Optional.
Definition document.hpp:247
std::string feature
Name of the varied feature. Optional.
Definition document.hpp:245
std::vector< float > feature_values
Each instance's own value of the feature (num_instances of them, or any number for ALE),...
Definition document.hpp:258
std::string method
"partial_dependence", or "ale" for accumulated local effects (CFS-2), whose grid is the bin edges and...
Definition document.hpp:243
int64_t num_instances
Number of ICE curves; 0 when the document holds the average only.
Definition document.hpp:253
std::vector< float > ice
Row-major (num_instances, grid.size()), or empty.
Definition document.hpp:255
std::vector< float > partial_dependence
One value per grid point.
Definition document.hpp:251
std::vector< float > grid
Strictly increasing feature values.
Definition document.hpp:249
A fitted PCA.
Definition pca.hpp:30
pulsatrix.projection.v1: inputs placed in a few dimensions (INT-5), such as their first principal com...
Definition document.hpp:398
std::vector< float > explained_variance_ratio
Each axis's share of the variance, or empty when it has none.
Definition document.hpp:405
std::vector< std::string > axes
One name per dimension, for example "PC1". At least two.
Definition document.hpp:403
std::string title
Definition document.hpp:399
std::vector< float > coordinates
Row-major (points, axes).
Definition document.hpp:407
std::vector< float > values
One per point, or empty.
Definition document.hpp:413
int64_t num_points() const
Definition document.hpp:415
std::vector< std::string > groups
One per point, or empty.
Definition document.hpp:411
std::vector< std::string > labels
One per point, or empty.
Definition document.hpp:409
std::string method
How the coordinates were made, for example "pca". Optional.
Definition document.hpp:401
Definition document.hpp:290
float value
The input's own value.
Definition document.hpp:292
float low
Definition document.hpp:293
float output_high
Definition document.hpp:296
std::string name
Definition document.hpp:291
float high
Definition document.hpp:294
float output_low
Definition document.hpp:295
pulsatrix.sensitivity.v1: how one output moves when each input feature, alone, goes to a low and a hi...
Definition document.hpp:285
std::vector< Feature > features
In any order; views sort them by swing.
Definition document.hpp:299
float output
The output at the unchanged input.
Definition document.hpp:289
std::string target
What the output is, for example a class name. Optional.
Definition document.hpp:287
Definition document.hpp:368
std::string name
Definition document.hpp:369
float first_order
Definition document.hpp:370
float total_order
Definition document.hpp:371
float total_order_conf
Definition document.hpp:373
float first_order_conf
Definition document.hpp:372
pulsatrix.sobol.v1: first- and total-order Sobol indices per feature (CFS-4).
Definition document.hpp:365
std::string target
Definition document.hpp:366
std::vector< Feature > features
Definition document.hpp:375
int64_t num_samples
Definition document.hpp:367
Sobol indices, one entry per varied feature (SALib's sobol.analyze, first and total order).
Definition global_sensitivity.hpp:84
pulsatrix.token_relevance.v1: relevance scores over the pieces of a text, in reading order....
Definition document.hpp:104
bool is_scored(size_t i) const
Whether piece i carries a score.
Definition document.hpp:124
std::string granularity
"token" or "word": what the scored pieces are. Written only when "word".
Definition document.hpp:114
std::vector< std::string > tokens
The pieces as text, in order; concatenated, they read as the text. Must be valid UTF-8: decode byte-l...
Definition document.hpp:108
std::vector< float > relevance
One score per piece.
Definition document.hpp:110
std::string target
What was explained, for example the predicted next token. Optional.
Definition document.hpp:112
std::vector< bool > scored
Whether each piece carries a score; empty means all do. Unscored pieces are context,...
Definition document.hpp:118
std::optional< float > unassigned
Relevance that belongs to no piece shown, such as a BOS token left out or tokens between words....
Definition document.hpp:121
std::string method
Definition document.hpp:105
Definition document.hpp:174
std::vector< float > values
Definition document.hpp:176
std::string tag
Definition document.hpp:175
Definition document.hpp:169
std::vector< double > values
Definition document.hpp:172
std::vector< int64_t > steps
Definition document.hpp:171
std::string tag
Definition document.hpp:170
pulsatrix.training_log.v1: scalar series and the latest histogram per tag.
Definition document.hpp:168
std::vector< Series > scalars
Sorted by tag.
Definition document.hpp:179
std::vector< Histogram > histograms
Sorted by tag.
Definition document.hpp:181