|
pulsatrix 1.1.0
|
Dependency-free SVG figures from viz documents: bar, waterfall, heatmap, token strip, beeswarm, partial dependence, tornado, counterfactual, Morris and Sobol charts. More...


Go to the source code of this file.
Classes | |
| struct | pulsatrix::SvgOptions |
| Options shared by every SVG chart. More... | |
| struct | pulsatrix::PartialDependenceSvgOptions |
| Options for RenderPartialDependenceSvg. More... | |
Namespaces | |
| namespace | pulsatrix |
Enumerations | |
| enum class | pulsatrix::IceStyle { pulsatrix::Raw , pulsatrix::Centered , pulsatrix::Derivative } |
| Which form of the ICE curves RenderPartialDependenceSvg draws (CFS-1). More... | |
Functions | |
| std::string | pulsatrix::RenderBarChartSvg (const AttributionDocument &doc, int top_k=10, const SvgOptions &options={}) |
Horizontal bars of the top_k features with the largest |attribution|, largest first, on an axis through zero, each colored by its signed value and labeled with it. Labels come from metadata["feature_names"] (comma-separated) when present. | |
| std::string | pulsatrix::RenderWaterfallSvg (const AttributionDocument &doc, float baseline_value, const SvgOptions &options={}) |
A waterfall from baseline_value through each feature's contribution, in the document's feature order, to the final value: red columns raise the running total, blue columns lower it, with the baseline and the final value marked. | |
| std::string | pulsatrix::RenderHeatmapSvg (const HeatmapDocument &doc, const SvgOptions &options={}) |
| The heatmap's grid with square cells and a color bar. Signed grids use the diverging map on a range symmetric about zero, unsigned grids Viridis on [0, max] (ComputeHeatmapColorScale's rule). Non-finite cells are gray and left out of the scale. Row and column labels are drawn when the document has them. | |
| std::string | pulsatrix::RenderTokenStripSvg (const TokenRelevanceDocument &doc, const SvgOptions &options={}) |
| The text's pieces (tokens or words) in reading order, wrapped across lines, each on a background colored by its relevance (diverging, scaled to the largest |relevance|). Pieces are drawn in a monospace font, so their widths are exact, with whitespace kept. Unscored pieces (context such as the spaces between words) are plain text and don't count toward the scale; non-finite relevance is drawn gray. The target and the unassigned relevance, when set, are shown after the text. | |
| std::string | pulsatrix::RenderBeeswarmSvg (const std::vector< AttributionDocument > &docs, const std::vector< int64_t > &feature_indices, const SvgOptions &options={}) |
One beeswarm row per feature in feature_indices: each point is one document's value for that feature, placed by value on a shared axis through zero, spread vertically so points don't overlap (ToBeeswarmPoints's deterministic layout), and colored by value. Labels come from the first document's metadata["feature_names"] when present. | |
| std::string | pulsatrix::RenderPartialDependenceSvg (const PartialDependenceDocument &doc, const PartialDependenceSvgOptions &pd={}, const SvgOptions &options={}) |
| A partial dependence plot: thin ICE curves under the bold average, over the feature's grid, with a rug of the instances' own feature values along the bottom. For IceStyle::Centered and IceStyle::Derivative the average is recomputed from the transformed curves, and a dashed line marks zero. | |
| std::string | pulsatrix::RenderTornadoSvg (const SensitivityDocument &doc, int top_k=10, const SvgOptions &options={}) |
A tornado chart: one row per feature, the top_k with the largest swing first. Each row has two bars from the unchanged output, one to the output at the feature's high value (red) and one to its low value (blue), labeled with those values; a dashed line marks the unchanged output. | |
| std::string | pulsatrix::RenderCounterfactualSvg (const CounterfactualDocument &doc, int max_rows=12, const SvgOptions &options={}) |
| What a counterfactual changed: a verdict line (whether it reaches the target, and the output before and after), then one row per changed feature, costliest first, with its old and new value and a bar of its change in units of its scale, colored by direction. A feature counts as changed when it moved by more than 1e-3 of its scale. | |
| std::string | pulsatrix::RenderMorrisSvg (const MorrisDocument &doc, const SvgOptions &options={}) |
| Morris screening as a scatter of mu* (importance) against sigma (how much the effect varies), one labeled point per feature with a horizontal bar for mu*'s confidence interval. Points above the dashed line sigma = mu* have effects that vary more than their average: nonlinear, or interacting with other features. | |
| std::string | pulsatrix::RenderSobolSvg (const SobolDocument &doc, int top_k=10, const SvgOptions &options={}) |
Sobol indices: one row per feature, the top_k with the largest total order first, with a bar for the first-order index, a lighter bar for the total-order index behind it, and whiskers for both confidence intervals. The gap between the two bars is the share of variance the feature explains only through interactions. | |
| std::string | pulsatrix::RenderProjectionSvg (const ProjectionDocument &doc, int x_axis=0, int y_axis=1, const SvgOptions &options={}) |
| A projection as a scatter plot of two of its axes (INT-5), both on one scale so distances on the page are distances in the projection. Points are colored by group with a legend, else by value on Viridis with a color bar (gray where a value isn't finite), and each has a tooltip with its label and coordinates. Lines mark zero, the mean of a PCA. | |
| std::string | pulsatrix::RenderCounterfactualSetSvg (const std::vector< CounterfactualDocument > &docs, const SvgOptions &options={}) |
| Several counterfactuals of one input side by side (CFS-7): a column for the input and one per counterfactual (headed by whether it reaches the target), and a row for every feature that at least one of them changes. Changed values are on a background colored by the change's direction and size in scale units; unchanged ones are blank. | |
Dependency-free SVG figures from viz documents: bar, waterfall, heatmap, token strip, beeswarm, partial dependence, tornado, counterfactual, Morris and Sobol charts.
Each function returns a complete standalone SVG file as a string. No GPU, display, font library or ImGui is involved, so figures can be made in CI and on headless machines. Colors come from colormap.hpp, the same as the ImGui widgets: DivergingColormap for signed values (blue negative, white zero, red positive) and ViridisColormap for unsigned magnitudes.
Output is deterministic: the same input gives the same bytes on every platform. Text widths are estimated (0.6 em per character), since there is no font library; labels are sized to leave room for that estimate.
tools/render/pulsatrix_svg.cpp wraps these as a command-line tool that turns a JSON document into an SVG file.