|
pulsatrix 1.1.0
|
Versioned JSON documents (pulsatrix.<kind>.v1) that every renderer reads.
More...
#include <cstdint>#include <map>#include <optional>#include <string>#include <string_view>#include <vector>#include "pulsatrix/attribution.hpp"#include "pulsatrix/circuit_graph.hpp"#include "pulsatrix/counterfactual.hpp"#include "pulsatrix/device_backend.hpp"#include "pulsatrix/global_sensitivity.hpp"#include "pulsatrix/ice.hpp"#include "pulsatrix/metrics_sink.hpp"#include "pulsatrix/pca.hpp"#include "pulsatrix/sensitivity.hpp"#include "pulsatrix/viz/implot_metrics_sink.hpp"#include "pulsatrix/viz/plot_data.hpp"

Go to the source code of this file.
Classes | |
| struct | pulsatrix::AttributionDocument |
pulsatrix.attribution.v1: an Attribution's values, shape, method and metadata. More... | |
| struct | pulsatrix::HeatmapDocument |
pulsatrix.heatmap.v1: a row-major grid of values with optional axis labels. More... | |
| struct | pulsatrix::TokenRelevanceDocument |
pulsatrix.token_relevance.v1: relevance scores over the pieces of a text, in reading order. MakeTokenRelevanceDocument() and MakeWordRelevanceDocument() (viz/text_relevance.hpp) build one from a tokenizer's Encoding or from word scores. More... | |
| struct | pulsatrix::CircuitGraphDocument |
pulsatrix.circuit_graph.v1: a CircuitGraph's scored nodes and weighted edges. More... | |
| struct | pulsatrix::CircuitGraphDocument::Node |
| struct | pulsatrix::CircuitGraphDocument::Edge |
| struct | pulsatrix::TrainingLogDocument |
pulsatrix.training_log.v1: scalar series and the latest histogram per tag. More... | |
| struct | pulsatrix::TrainingLogDocument::Series |
| struct | pulsatrix::TrainingLogDocument::Histogram |
| struct | pulsatrix::FeatureDashboardDocument |
pulsatrix.feature_dashboard.v1: one learned feature (for example a sparse autoencoder unit) with its activation statistics and top-activating examples. More... | |
| struct | pulsatrix::FeatureDashboardDocument::Example |
| struct | pulsatrix::PartialDependenceDocument |
pulsatrix.partial_dependence.v1: a partial dependence curve over one feature, with the individual (ICE) curves it averages when they were computed (CFS-1). More... | |
| struct | pulsatrix::SensitivityDocument |
pulsatrix.sensitivity.v1: how one output moves when each input feature, alone, goes to a low and a high value (CFS-3). The data behind a tornado chart. More... | |
| struct | pulsatrix::SensitivityDocument::Feature |
| struct | pulsatrix::CounterfactualDocument |
pulsatrix.counterfactual.v1: an input, its counterfactual, and what reaching the target cost (CFS-5). More... | |
| struct | pulsatrix::CounterfactualDocument::Feature |
| struct | pulsatrix::MorrisDocument |
pulsatrix.morris.v1: Morris screening statistics per feature (CFS-4). More... | |
| struct | pulsatrix::MorrisDocument::Feature |
| struct | pulsatrix::SobolDocument |
pulsatrix.sobol.v1: first- and total-order Sobol indices per feature (CFS-4). More... | |
| struct | pulsatrix::SobolDocument::Feature |
| struct | pulsatrix::ProjectionDocument |
pulsatrix.projection.v1: inputs placed in a few dimensions (INT-5), such as their first principal components, for a scatter plot. Each point can carry a label (shown on hover), a group (drawn as a color) and a value (drawn on a color scale when there are no groups). More... | |
Namespaces | |
| namespace | pulsatrix |
Functions | |
| std::string | pulsatrix::VizDocumentKind (std::string_view json) |
Reads only a document's "schema" member and returns its kind (for example "attribution"), so a viewer can pick the matching reader. | |
| AttributionDocument | pulsatrix::ToAttributionDocument (const Attribution &attr) |
Copies attr into a document, reading its values to the host. | |
| Attribution | pulsatrix::ToAttribution (const AttributionDocument &doc, DeviceBackend *backend) |
Rebuilds an Attribution whose values live on backend. | |
| std::string | pulsatrix::ToJson (const AttributionDocument &doc) |
| AttributionDocument | pulsatrix::ParseAttributionDocument (std::string_view json) |
| HeatmapDocument | pulsatrix::ToHeatmapDocument (const HeatmapGrid &grid, std::string title="") |
| HeatmapGrid | pulsatrix::ToHeatmapGrid (const HeatmapDocument &doc) |
| std::string | pulsatrix::ToJson (const HeatmapDocument &doc) |
| HeatmapDocument | pulsatrix::ParseHeatmapDocument (std::string_view json) |
| std::string | pulsatrix::ToJson (const TokenRelevanceDocument &doc) |
| TokenRelevanceDocument | pulsatrix::ParseTokenRelevanceDocument (std::string_view json) |
| CircuitGraphDocument | pulsatrix::ToCircuitGraphDocument (const CircuitGraph &graph) |
| CircuitGraph | pulsatrix::ToCircuitGraph (const CircuitGraphDocument &doc) |
| std::string | pulsatrix::ToJson (const CircuitGraphDocument &doc) |
| CircuitGraphDocument | pulsatrix::ParseCircuitGraphDocument (std::string_view json) |
| const char * | pulsatrix::OpTypeName (OpType op_type) |
The name ToCircuitGraphDocument writes for op_type, for example "Linear". | |
| OpType | pulsatrix::OpTypeFromName (std::string_view name) |
| TrainingLogDocument | pulsatrix::ToTrainingLogDocument (const ImPlotMetricsSink &sink) |
Copies everything sink has logged, sorted by tag. | |
| void | pulsatrix::ReplayTrainingLog (const TrainingLogDocument &doc, MetricsSink &sink) |
Logs every scalar in doc to sink in the order recorded, then every histogram (at step 0, since the log keeps only the latest one), so any sink can show a saved run: an ImPlotMetricsSink for the training dashboard, for example. | |
| std::string | pulsatrix::ToJson (const TrainingLogDocument &doc) |
| TrainingLogDocument | pulsatrix::ParseTrainingLogDocument (std::string_view json) |
| std::string | pulsatrix::ToJson (const FeatureDashboardDocument &doc) |
| FeatureDashboardDocument | pulsatrix::ParseFeatureDashboardDocument (std::string_view json) |
| PartialDependenceDocument | pulsatrix::ToPartialDependenceDocument (const IceResult &result, std::string feature="", std::string target="") |
Copies result, its partial dependence curve included. | |
| PartialDependenceDocument | pulsatrix::ToPartialDependenceDocument (const AleResult &result, std::string feature="", std::string target="") |
An ALE curve as a document with method "ale": the bin edges as the grid, the effects as the curve, and the instances' feature values for the rug. | |
| IceResult | pulsatrix::ToIceResult (const PartialDependenceDocument &doc) |
| Rebuilds the ICE curves for their centered and derivative views. | |
| HeatmapDocument | pulsatrix::ToHeatmapDocument (const PartialDependence2D &pd, std::string title="") |
| A two-feature partial dependence as a heatmap: rows follow grid_y, columns grid_x, and the labels are the grid values. | |
| std::string | pulsatrix::ToJson (const PartialDependenceDocument &doc) |
| PartialDependenceDocument | pulsatrix::ParsePartialDependenceDocument (std::string_view json) |
| SensitivityDocument | pulsatrix::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 name are called feature_<index>. | |
| std::string | pulsatrix::ToJson (const SensitivityDocument &doc) |
| SensitivityDocument | pulsatrix::ParseSensitivityDocument (std::string_view json) |
| CounterfactualDocument | pulsatrix::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; scale should be the one the search used. | |
| std::string | pulsatrix::ToJson (const CounterfactualDocument &doc) |
| CounterfactualDocument | pulsatrix::ParseCounterfactualDocument (std::string_view json) |
| MorrisDocument | pulsatrix::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, in order); otherwise features are called feature_<index>. | |
| SobolDocument | pulsatrix::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, in order); otherwise features are called feature_<index>. | |
| std::string | pulsatrix::ToJson (const MorrisDocument &doc) |
| MorrisDocument | pulsatrix::ParseMorrisDocument (std::string_view json) |
| std::string | pulsatrix::ToJson (const SobolDocument &doc) |
| SobolDocument | pulsatrix::ParseSobolDocument (std::string_view json) |
| ProjectionDocument | pulsatrix::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 variance ratios. | |
| ProjectionDocument | pulsatrix::MakeProjectionDocument (const Tensor &coordinates, std::string method, std::vector< std::string > labels={}, std::vector< std::string > groups={}, std::vector< float > values={}, std::string title="") |
A projection document from coordinates made elsewhere, such as UMAP or t-SNE output read with ReadNpy() (embedding_export.hpp): axes <method> 1, <method> 2, ..., and no variance shares. | |
| bool | pulsatrix::IsNeighborEmbedding (const ProjectionDocument &doc) |
Whether the document's method is UMAP or t-SNE (umap, tsne, t-sne or opentsne, any case), whose plots keep neighbors but not distances, cluster sizes or densities. The views say so on such plots. | |
| std::string | pulsatrix::ToJson (const ProjectionDocument &doc) |
| ProjectionDocument | pulsatrix::ParseProjectionDocument (std::string_view json) |
Variables | |
| constexpr int | pulsatrix::kVizDocumentVersion = 1 |
| The document format version this build writes and reads. | |
Versioned JSON documents (pulsatrix.<kind>.v1) that every renderer reads.
Each kind is a plain struct with a writer (ToJson) and a reader (Parse<Kind>Document). The structs hold data only, never colors or layout, so the ImGui widgets, the SVG renderer and anything outside pulsatrix draw the same numbers.
Format rules (docs/visualization/documents.md has the full schema):
"schema" member is "pulsatrix.<kind>.v<N>".null, and the document's top-level "nonfinite" object maps that number's JSON Pointer (RFC 6901, for example "/values/3") to "nan", "inf" or "-inf". The member is present only when the document has a non-finite number. A null where a number belongs and no "nonfinite" entry for it is an error, so data is never silently lost.