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

Self-contained HTML views of the viz documents (VIZ-3): interactive Vega-Lite charts with tooltips, zoom and PNG/SVG export, and plain-HTML text views, in any browser or notebook. More...

#include <cstdint>
#include <string>
#include <vector>
#include "pulsatrix/json.hpp"
#include "pulsatrix/viz/document.hpp"
#include "pulsatrix/viz/series.hpp"
#include "pulsatrix/viz/svg.hpp"
Include dependency graph for html.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pulsatrix::HtmlOptions
 Options for every HTML view. More...
 

Namespaces

namespace  pulsatrix
 

Enumerations

enum class  pulsatrix::HtmlScripts { pulsatrix::Cdn , pulsatrix::Inline }
 How a page gets the Vega libraries. More...
 

Functions

JsonValue pulsatrix::ToVegaLiteBarChart (const AttributionDocument &doc, int top_k=10, const HtmlOptions &options={})
 Horizontal bars of the top_k features with the largest |attribution|, colored by sign on the SVG renderer's diverging scale.
 
JsonValue pulsatrix::ToVegaLiteWaterfall (const AttributionDocument &doc, float baseline_value, const HtmlOptions &options={})
 A waterfall from baseline_value through the features' contributions to the prediction (ToWaterfallSteps).
 
JsonValue pulsatrix::ToVegaLiteHeatmap (const HeatmapDocument &doc, const HtmlOptions &options={})
 A heatmap: diverging around zero when any value is negative, Viridis otherwise. Non-finite cells are gray.
 
JsonValue pulsatrix::ToVegaLiteBeeswarm (const std::vector< AttributionDocument > &docs, const std::vector< int64_t > &feature_indices, const HtmlOptions &options={})
 One row per feature in feature_indices: every document's value for it, spread so points don't overlap (ToBeeswarmPoints).
 
JsonValue pulsatrix::ToVegaLitePartialDependence (const PartialDependenceDocument &doc, const PartialDependenceSvgOptions &pd={}, const HtmlOptions &options={})
 A partial dependence plot: ICE curves under the average, and a rug of the instances' feature values. Zoom with the mouse wheel; drag to pan.
 
JsonValue pulsatrix::ToVegaLiteTornado (const SensitivityDocument &doc, int top_k=10, const HtmlOptions &options={})
 A tornado chart of the top_k features with the largest swing.
 
JsonValue pulsatrix::ToVegaLiteCounterfactual (const CounterfactualDocument &doc, int max_rows=12, const HtmlOptions &options={})
 The changed features of a counterfactual, costliest first, as bars of their change in scale units; the tooltip has the old and new values.
 
JsonValue pulsatrix::ToVegaLiteCounterfactualSet (const std::vector< CounterfactualDocument > &docs, const HtmlOptions &options={})
 Several counterfactuals of one input: a grid of features (rows) by counterfactuals (columns), each cell colored by the change in scale units and labeled with the new value.
 
JsonValue pulsatrix::ToVegaLiteMorris (const MorrisDocument &doc, const HtmlOptions &options={})
 Morris screening: mu* against sigma per feature, with mu*'s confidence interval and the sigma = mu* line.
 
JsonValue pulsatrix::ToVegaLiteSobol (const SobolDocument &doc, int top_k=10, const HtmlOptions &options={})
 Sobol indices: first-order bars in front of total-order ones, with confidence whiskers.
 
JsonValue pulsatrix::ToVegaLiteProjection (const ProjectionDocument &doc, const HtmlOptions &options={})
 A projection as a zoomable scatter plot, colored as RenderProjectionSvg colors it, with each point's label on hover. With three or more axes, three panels: PC1 against PC2, PC1 against PC3 and PC2 against PC3, the views of a 3D projection.
 
JsonValue pulsatrix::ToVegaLiteTrainingLog (const TrainingLogDocument &doc, const HtmlOptions &options={})
 A training log: one zoomable line chart per scalar tag, and one histogram per histogram tag.
 
JsonValue pulsatrix::ToVegaLiteFeatureHistogram (const FeatureDashboardDocument &doc, const HtmlOptions &options={})
 A feature's activation histogram (the dashboard's chart; RenderFeatureDashboardHtml adds the top examples).
 
JsonValue pulsatrix::ToVegaLiteSeries (const SeriesDocument &doc, const SeriesViewOptions &view={}, const HtmlOptions &options={})
 A series document (VIZ-9): one zoomable chart per panel, stacked, each a line per series with points and interval rules, colored as RenderSeriesSvg colors them.
 
std::string pulsatrix::VegaLitePage (const JsonValue &spec, const std::string &heading, const HtmlOptions &options={}, const std::string &extra_html="")
 A complete page that draws spec with vega-embed, which adds the PNG/SVG export menu.
 
std::string pulsatrix::RenderBarChartHtml (const AttributionDocument &doc, int top_k=10, const HtmlOptions &options={})
 
std::string pulsatrix::RenderWaterfallHtml (const AttributionDocument &doc, float baseline_value, const HtmlOptions &options={})
 
std::string pulsatrix::RenderHeatmapHtml (const HeatmapDocument &doc, const HtmlOptions &options={})
 
std::string pulsatrix::RenderBeeswarmHtml (const std::vector< AttributionDocument > &docs, const std::vector< int64_t > &feature_indices, const HtmlOptions &options={})
 
std::string pulsatrix::RenderPartialDependenceHtml (const PartialDependenceDocument &doc, const PartialDependenceSvgOptions &pd={}, const HtmlOptions &options={})
 
std::string pulsatrix::RenderTornadoHtml (const SensitivityDocument &doc, int top_k=10, const HtmlOptions &options={})
 
std::string pulsatrix::RenderCounterfactualHtml (const CounterfactualDocument &doc, int max_rows=12, const HtmlOptions &options={})
 
std::string pulsatrix::RenderCounterfactualSetHtml (const std::vector< CounterfactualDocument > &docs, const HtmlOptions &options={})
 
std::string pulsatrix::RenderMorrisHtml (const MorrisDocument &doc, const HtmlOptions &options={})
 
std::string pulsatrix::RenderSobolHtml (const SobolDocument &doc, int top_k=10, const HtmlOptions &options={})
 
std::string pulsatrix::RenderProjectionHtml (const ProjectionDocument &doc, const HtmlOptions &options={})
 
std::string pulsatrix::RenderSeriesHtml (const SeriesDocument &doc, const SeriesViewOptions &view={}, const HtmlOptions &options={})
 
std::string pulsatrix::RenderTrainingLogHtml (const TrainingLogDocument &doc, const HtmlOptions &options={})
 
std::string pulsatrix::RenderFeatureDashboardHtml (const FeatureDashboardDocument &doc, const HtmlOptions &options={}, const std::string &extra_html="")
 The feature's statistics, its activation histogram, and its top examples with each token shaded by its activation. extra_html is appended as is, such as a structure panel (StructurePanelHtml, PLM-8).
 
std::string pulsatrix::RenderTokenRelevanceHtml (const TokenRelevanceDocument &doc, const HtmlOptions &options={})
 The text with each piece (token or word) on a background colored by its relevance, as plain HTML with no scripts: the browser lays out and shapes the text, so every script reads correctly (right-to-left, joined Arabic, Indic conjuncts), and wraps it. Hovering a piece shows its score; unscored pieces are plain text. Scripts option is ignored.
 

Variables

constexpr const char * pulsatrix::kVegaVersion = "6.4.0"
 The versions of Vega, Vega-Lite and vega-embed the pages load (BSD-3-Clause).
 
constexpr const char * pulsatrix::kVegaLiteVersion = "6.4.3"
 
constexpr const char * pulsatrix::kVegaEmbedVersion = "7.3.0"
 

Detailed Description

Self-contained HTML views of the viz documents (VIZ-3): interactive Vega-Lite charts with tooltips, zoom and PNG/SVG export, and plain-HTML text views, in any browser or notebook.