Python API

Stateless analysis

diffract.analyze(model: Any, *, fields: tuple[str, ...] = ('frob_norm', 'l2_norm', 'lower_dim', 'stable_rank', 'effective_rank', 'esd'), export_format: str = 'list', required_names: Iterable[str] = (), return_coverage: Literal[False] = False) → AnalysisResult[source]
diffract.analyze(model: Any, *, fields: tuple[str, ...] = ('frob_norm', 'l2_norm', 'lower_dim', 'stable_rank', 'effective_rank', 'esd'), export_format: str = 'list', required_names: Iterable[str] = (), return_coverage: Literal[True]) → tuple[AnalysisResult, ExtractionReport]

Analyze weight matrices in a fresh in-memory session.

Parameters:
  • model – A supported model object or mapping of names to weight matrices.

  • fields – Registered parameter fields. Defaults to two norms, the spectrum size, stable and effective rank, and the full ESD.

  • export_format – Long result format, such as “list”, “pandas”, or “polars”.

  • required_names – Exact source parameter names that must be extracted.

  • return_coverage – Return the analysis and its extraction report as a pair.

Returns:

An AnalysisResult with long result rows and numeric summaries, or a pair of the AnalysisResult and ExtractionReport when return_coverage is true.

diffract.compare(source: Any, target: Any, *, fields: tuple[str, ...] = _COMPARE_FIELDS, export_format: str = 'list', return_coverage: Literal[False] = False, required_names: Iterable[str] = ()) → Any[source]
diffract.compare(source: Any, target: Any, *, fields: tuple[str, ...] = _COMPARE_FIELDS, export_format: str = 'list', return_coverage: Literal[True], required_names: Iterable[str] = ()) → tuple[Any, PairCoverage]
diffract.compare(source: Any, target: Any, *, fields: tuple[str, ...] = _COMPARE_FIELDS, export_format: str = 'list', return_coverage: bool, required_names: Iterable[str] = ()) → Any | tuple[Any, PairCoverage]

Compare same-name weight matrices in two models in source-to-target order.

The full set of default fields requires matched matrices of the same shape.

Parameters:
  • source – The source model or named weight matrices.

  • target – The target model or named weight matrices.

  • fields – Registered cross-model fields. Defaults to source-relative weight and singular-value changes and the per-component diagonal and best-match profiles for both singular-vector bases.

  • export_format – Long result format, such as “list”, “pandas”, or “polars”.

  • return_coverage – Return the long rows and a PairCoverage report. Each field is evaluated on names with compatible matrix dimensions.

  • required_names – Stored parameter names required at both endpoints with compatible dimensions for every requested field.

Returns:

Long aggregate rows with the source and target roles labeled, or a pair of the formatted rows and their report when coverage is requested.

class diffract.AnalysisResult(details: Any, summary: dict[str, dict[str, int | float | None]])[source]

Bases: object

Long-form parameter values and their per-field numeric summaries.

details: Any
summary: dict[str, dict[str, int | float | None]]
class diffract.core.data.nn.extractors.report.ExtractionReport(items: tuple[ExtractionItem, ...])[source]

Bases: object

Per-input outcomes for one checkpoint, without retaining its tensors.

items: tuple[ExtractionItem, ...]
property counts: dict[str, int]

Count weight candidates and each outcome. Exclusions are non-candidates.

class diffract.session.summaries.PairCoverage(source: tuple[str, int], target: tuple[str, int], source_only: tuple[str, ...], target_only: tuple[str, ...], matched: tuple[str, ...], source_extraction: ExtractionReport | None, target_extraction: ExtractionReport | None, incompatible: dict[str, tuple[ShapeMismatch, ...]], measured: dict[str, tuple[str, ...]])[source]

Bases: PairMismatch

Name join in scope, original admission reports and results by field.

matched: tuple[str, ...]
source_extraction: ExtractionReport | None
target_extraction: ExtractionReport | None
incompatible: dict[str, tuple[ShapeMismatch, ...]]
measured: dict[str, tuple[str, ...]]
property source_count: int

Number of stored source names in the active scope.

property target_count: int

Number of stored target names in the active scope.

property measurement_counts: dict[str, int]

Count distinct measured aggregates for each field of this ordered pair.

source: tuple[str, int]
target: tuple[str, int]
source_only: tuple[str, ...]
target_only: tuple[str, ...]

Field selectors

class diffract.FieldSelector(field: str, models: tuple[str, ...] | None = None, params: tuple[str, ...] | None = None, steps: tuple[int, ...] | None = None, roles: tuple[str, ...] | None = None)[source]

Bases: object

Structured address of a stored value.

Parameters:
  • field – Base field name.

  • models – Model names constraining the address, or None when unconstrained.

  • params – Parameter names constraining the address, or None when unconstrained.

  • steps – Training steps in source, target order when roles are given. Otherwise, step order is ignored.

  • roles – Source and target model names for an ordered pair.

field: str
models: tuple[str, ...] | None = None
params: tuple[str, ...] | None = None
steps: tuple[int, ...] | None = None
roles: tuple[str, ...] | None = None
property is_contextual: bool

Whether the address constrains models, parameters, steps, or roles.

classmethod from_context(record: dict[str, Any]) → FieldSelector[source]

Build a selector from a decoded context dictionary.

matches(candidate: FieldSelector) → bool[source]

Match set constraints independently of order and pair slots in order.

Session

class diffract.Session(profile: str | None = 'ram', config_path: str | Path | None = None, container: MainContainer | None = None, other_session: Session | None = None)[source]

Bases: object

Main session class for neural network parameter analysis.

Provides a high-level interface for adding models, applying computational kernels, and retrieving results. Manages the complete lifecycle of parameter analysis workflows through dependency injection and modular components.

Example

>>> session = Session()
>>> session.models.add(my_model, model_id="bert-base")
>>> session.compute.apply("frob_norm", "stable_rank")
>>> results = session.results.export_metrics(
...     "frob_norm", "stable_rank", export_format="pandas"
... )

Initialize a new session.

Parameters:
  • profile – Built-in profile name for quick setup: - “ram”: RAM storage, no persistence (fast experiments) - “local”: SQLite storage in .diffract/ (persistent, simple) - “hybrid”: SQLite + HDF5 (persistent, optimized for large arrays)

  • config_path – Path to configuration file (YAML/JSON/INI). Takes priority over profile if both are provided.

  • container – Pre-configured MainContainer instance. If None, creates new container using config_path or profile.

  • other_session – Another Session instance to copy configuration from.

filter(param_ids: list[str] | None = None, param_names: list[str] | None = None, param_types: list[ParameterType] | None = None, model_ids: list[str] | None = None, steps: StepSelection | None = None) → SessionContext[source]

Create a filtered view of the session’s parameters and aggregates.

Parameters:
  • param_ids – Parameter IDs to keep, or None for no ID filtering.

  • param_names – Parameter names to keep, or None for no name filtering.

  • param_types – Parameter types to keep, or None for no type filtering.

  • model_ids – Model IDs to keep, or None for no model filtering.

  • steps – Checkpoint numbers, or “final” for each model’s maximum step.

Returns:

A SessionContext scoped to the filtered parameter and aggregate views.

exception diffract.session.SessionError[source]

Bases: Exception

Base exception class for session-related errors.

exception diffract.session.ModelNotFoundError[source]

Bases: SessionError

Raised when a model is not found in the session.

exception diffract.session.ModelAlreadyExistsError[source]

Bases: SessionError

Raised when a model with the same id already exists.

exception diffract.session.KernelNotFoundError[source]

Bases: SessionError

Raised when a kernel is not found in the registry.

exception diffract.session.ScopeValidationError[source]

Bases: SessionError

Raised when the active scope is incompatible with a kernel’s apply level.

A binary cross-model kernel requires exactly two model/checkpoint coordinates. An incompatible scope raises this error before execution.

exception diffract.session.InvalidIdentifierError[source]

Bases: SessionError

Raised when a model id, parameter name, or field name is not accepted.

Identity strings are validated at every ingest boundary against a documented alphabet; the message names the offending character.

exception diffract.session.IncompatibleStoreError[source]

Bases: SessionError

Raised when a metadata index has an incompatible or incomplete schema.

The message gives the next step for that store.

exception diffract.session.UnrecognizedStoreError[source]

Bases: SessionError

Raised when a session’s configured path is not a diffract store.

A metadata path that names another application’s database is refused before anything is written to it: the remedy is fixing the path, not upgrading the file, so this is distinct from IncompatibleStoreError. The message names the identity check that failed.

SVD workspace

diffract.core.compute.extensions.svd_workspace.estimate_svd_workspace_bytes(matrix: np.ndarray, *, vectors: bool) → int[source]

Budget scratch space, input copies, and sorted economy factors for GESDD.

The estimate reserves eight bytes per real element. For shorter dimension k, 64k + max(m, n) covers linear work and 3mn covers matrix-sized temporaries. Vectors add mn + 10k² for factor copies, sorting and quadratic workspace. These coefficients are conservative allowances, not LAPACK workspace minima.

Session namespaces

The Session API surface is organized into namespaces, available as session.models, session.compute, session.results, session.viz, and session.utils.

class diffract.session.namespaces.ModelsNamespace(session_or_context: Session | SessionContext, parameter_repository: IParameterRepository = Provide['nn.parameter_repository'], aggregate_repository: AggregateRepository = Provide['nn.aggregate_repository'], extractor_factory: Callable[..., IParameterExtractor] = Provide['nn.extractor_factory.provider'], parameters: ParametersNamespace | None = None)[source]

Bases: object

Model management API.

add(model: Any, model_id: str | None = None, parameter_overrides: dict[str, ParameterOverrides] | None = None, custom_handlers: Iterable[ParameterHandler] | None = None, *, step: int = 0, display_label: str | None = None, required_names: Iterable[str] = ()) → ExtractionReport[source]

Add a neural network model to the session.

Stores a snapshot of the weights at this step. Once this call returns, the caller can update the model or reuse its arrays for the next step. Persistent profiles also make the checkpoint available in later sessions.

Parameters:
  • model – Neural network model object (PyTorch, TensorFlow, etc.) or a dict mapping parameter names to NumPy arrays.

  • model_id – Unique identifier for the model. Auto-generated if None.

  • parameter_overrides – Custom parameter extraction overrides by name.

  • custom_handlers – Additional parameter handlers for custom parameter types.

  • step – Nonnegative training step. Defaults to zero.

  • display_label – Optional display text for this checkpoint.

  • required_names – Exact source parameter names that must be extractable. Their converted weights are held in memory until all required names pass. Other eligible parameters are also stored.

Returns:

Per-name extraction outcomes, reasons and source and storage dtypes.

Raises:
  • ModelAlreadyExistsError – If the model already has parameters at this step.

  • TypeError – If the step is not an integer or the label is not text.

  • ValueError – If the step is negative or exceeds the storage range.

  • InvalidIdentifierError – If model_id is not over the accepted identifier alphabet.

  • EmptyExtractionError – If there are no extracted parameters. Its coverage attribute contains the per-input reasons.

  • SessionError – If required names cannot be extracted or the import fails.

set_display_label(model_id: str, step: int, label: str) → None[source]

Set the display text for an existing checkpoint in this scope.

rename(model_id: str, new_model_id: str) → None[source]

Rename a model in the session.

Parameters:
  • model_id – ID of the model to rename.

  • new_model_id – New ID for the model.

Raises:
erase(*model_ids: str | tuple[str, int], erase_all: bool = False) → EraseSummary[source]

Erase selected parameters and the aggregates that reference them.

The catalog tombstones their fields. A model remains registered while any checkpoint still has parameters.

Parameters:
  • *model_ids – Exact model names or (model name, step) pairs to erase.

  • erase_all – Select every model visible in this scope. Pass no model IDs.

Returns:

An EraseSummary naming the affected models and counting removed parameters.

Raises:
  • ValueError – If neither model_ids nor erase_all is specified, or if both are specified.

  • ModelNotFoundError – If any specified model ID is not found.

list(*, layout: Literal['names'] = 'names') → list[str][source]
list(*, layout: Literal['coordinates']) → list[tuple[str, int]]
list(*, layout: Literal['grouped']) → dict[str, list[int]]

List model names or their training checkpoints within the current scope.

Parameters:

layout – "names" returns sorted model names. "coordinates" returns (name, step) pairs sorted by name and numeric step. "grouped" maps each model name to its ordered list of steps.

class diffract.session.namespaces.ComputeNamespace(session_or_context: Session | SessionContext, parameter_repository: IParameterRepository = Provide['nn.parameter_repository'], aggregate_repository: AggregateRepository = Provide['nn.aggregate_repository'], kernel_registry: KernelRegistry = Provide['compute.kernel_registry'], kernel_executor_factory: Callable[[], KernelExecutor] = Provide['compute.kernel_executor.provider'])[source]

Bases: object

Kernel compute API for Session.

apply(*fields_to_produce: str, recompute: bool = False, pairs: Iterable[tuple[Checkpoint, Checkpoint]] | None = None, return_coverage: bool = False, required_names: Iterable[str] = ()) → ApplySummary[source]

Compute the requested fields in dependency order within the active scope.

Parameters:
  • *fields_to_produce – Names of fields to compute using registered kernels.

  • recompute – Run the kernels that produce the requested fields even when their output groups are fresh. Kernels needed only as dependencies still follow the freshness check.

  • pairs – Ordered source and target checkpoints for cross-model kernels. A bare model name selects its latest step in the current scope. Parameters are matched by name within each selected pair.

  • return_coverage – Report the join and measure shape-compatible weights for each requested cross-model field in explicit pairs.

  • required_names – Stored parameter names required at both endpoints and compatible with all requested fields. Checked before execution.

Returns:

An ApplySummary grouping the written fields by apply level (which exporter now holds them) and listing any requested field that produced nothing. For explicit pairs, pair_mismatches lists parameter names without a counterpart. With return_coverage=True, pair_coverage contains one report for each distinct ordered pair.

Raises:
  • KernelNotFoundError – If any specified field cannot be produced.

  • ScopeValidationError – If an explicit pair is invalid or outside the active scope, or an implicit binary comparison has a scope with other than two checkpoints. Also raised for missing required names and incompatible shapes outside the requested coverage policy.

  • FieldNotFoundError – If a custom input field has no producer and is missing from a participating parameter.

  • SessionError – If kernel execution fails.

list_available_kernels(verbose: bool = False) → list[str][source]

List all available computational kernels.

Parameters:

verbose – If True, include detailed kernel information including dependencies and field requirements.

Returns:

List of kernel names or detailed kernel descriptions.

describe_field(name: str) → dict[str, Any][source]

Describe a registered field’s kernel, dependencies, and export route.

list_available_metrics(verbose: bool = False) → list[str][source]

List all fields that can be computed by registered kernels.

Parameters:

verbose – If True, include detailed field information including producing kernels and dependencies.

Returns:

List of computable field names or detailed field descriptions.

configure_kernel(kernel_name: str, **config: Any) → KernelConfig[source]

Configure parameters for a specific kernel.

Updates the configuration for a registered kernel, affecting subsequent computations using that kernel.

Parameters:
  • kernel_name – Name of kernel to configure.

  • **config – Kernel configuration parameters as keyword arguments.

Returns:

The effective KernelConfig applied to the kernel.

Raises:

KernelNotFoundError – If kernel is not registered in the registry.

kernel(_func: Callable[..., Any] | None = None, *, name: str | None = None, require_fields: tuple[str, ...] | None = None, produce_fields: tuple[str, ...] | None = None, apply_level: KernelApplyLevel = KernelApplyLevel.PARAMETER, execution_protocol: KernelExecutionProtocol = KernelExecutionProtocol.SEQUENTIAL, restrictions: KernelRestrictions | None = None, version: str = '1', output_comparison: OutputComparison | None = None) → Callable[[Callable[..., Any]], Callable[..., Any]][source]

Decorator for registering custom kernels in the session registry.

Creates a kernel that can compute metrics on neural network parameters. Dependencies are automatically inferred from function arguments.

Parameters:
  • name – Custom kernel name (defaults to function name).

  • require_fields – Input field names (inferred from signature if None).

  • produce_fields – Output field names (defaults to kernel name).

  • apply_level – Granularity at which the kernel is applied.

  • execution_protocol – Execution protocol for the kernel.

  • restrictions – Optional restrictions applied to kernel execution.

  • version – Change when the kernel behavior or an existing default changes.

  • output_comparison – Optional output equivalence and array comparison budget.

Returns:

Decorator function for registering the kernel.

Example

>>> session = Session()
>>> with session:
...
...     @session.compute.kernel()
...     def my_metric(frob_norm: float, *, scale: float = 1.0) -> float:
...         return frob_norm * scale
class diffract.session.namespaces.ResultsNamespace(session_or_context: Session | SessionContext, parameter_repository: IParameterRepository = Provide['nn.parameter_repository'], aggregate_repository: AggregateRepository = Provide['nn.aggregate_repository'], kernel_registry: KernelRegistry = Provide['compute.kernel_registry'], parallel_context_factory: Callable[[], ParallelContext] = Provide['parallel_singleton.thread_pool_context.provider'], results_exporter_factory: Callable[[], ResultExporter] = Provide['export.result_exporter.provider'], default_export_format: str | None = Provide['export.config.default_export_format'], kernel_executor_factory: Callable[[], KernelExecutor] = Provide['compute.kernel_executor.provider'])[source]

Bases: object

Results export and ingestion API for Session.

property generation: int

Revision of the session’s cached result metadata.

describe_run(run_id: str | None, *, parameter_uid: str | None = None) → dict[str, Any][source]

Look up requested settings and per-entity arithmetic by exported run ID.

Parameters:
  • run_id – The run_id from a long result row.

  • parameter_uid – Limit observations to one parameter of a batched run.

Returns:

Run metadata, the requested configuration and recorded arithmetic. The arithmetic status is “unknown” for runs without observations.

Raises:

SessionError – If the run is unknown or outside the selected scope.

status(*fields: str) → tuple[FieldStatus, ...][source]

Report freshness against stored inputs and the effective configuration.

Returns one entry per requested field and in-scope identity. An entry’s status is fresh, stale, or never computed. Inherited values eligible for verification have a pre-provenance reason. This call reads metadata without executing kernels or updating stored values.

Parameters:

*fields – Kernel-produced fields to inspect.

Raises:
export_metrics(*fields: FieldAddress, export_format: str | None = None) → Any[source]

Retrieve computation results for specified fields (metrics only).

Serves PARAMETER-level fields; IN_MODEL and CROSS_MODEL fields are retrieved with export_aggregates.

A field name that neither a registered kernel produces nor any stored field matches raises; a known field with no values in the current scope is reported with a warning instead of being silently omitted.

Parameters:
  • *fields – Field names, structured selectors, or references to either.

  • export_format – Output format - “dict”, “json”, “pandas”, “polars”, “list”. Defaults to the configured [export] default_export_format.

Returns:

Metric results in the specified format. Edits to exported arrays affect only the exported data.

Raises:

KernelNotFoundError – If a requested field is neither producible by a registered kernel nor stored in the current scope.

export_aggregates(*fields: FieldAddress, export_format: str | None = None) → Any[source]

Retrieve aggregation results for specified fields (aggregates only).

Serves IN_MODEL and CROSS_MODEL-level fields; PARAMETER fields are retrieved with export_metrics.

A field name that neither a registered kernel produces nor any stored field matches raises; a known field with no values in the current scope is reported with a warning instead of being silently omitted.

Parameters:
  • *fields – Field names, structured selectors, or references to either.

  • export_format – Output format - “dict”, “json”, “pandas”, “polars”, “list”. Defaults to the configured [export] default_export_format.

Returns:

Aggregation results in the specified format.

Raises:

KernelNotFoundError – If a requested field is neither producible by a registered kernel nor stored in the current scope.

ingest_metrics(fields_by_uid: dict[str, dict[str, Any]], *, force: bool = False) → None[source]

Ingest precomputed fields into the session via a uid->field mapping.

Field names are stored exactly as provided (including contextual suffixes like “metric@ctx”). By default, this method is strict and raises if any target field already exists; set force=True to overwrite.

Parameters:
  • fields_by_uid – Mapping of parameter uid -> {field_name: value}.

  • force – If False (default), raise on any existing field conflict. If True, overwrite existing field values.

Raises:
ingest_aggregates(aggregates: list[dict[str, Any]], *, force: bool = False) → None[source]

Ingest precomputed aggregate values into the session.

Model and parameter names select existing members in the current scope. The field and selected parameter identities identify each stored value.

Parameters:
  • aggregates – List of aggregate dictionaries, each containing: - field_name: Base field name (e.g., “l_overlap”). - context_models: Tuple/list of model IDs. - context_params: Tuple/list of parameter names (optional). - value: The computed value to store.

  • force – If False (default), raise on existing aggregate conflict. If True, overwrite existing values.

Raises:
  • InvalidIdentifierError – If a field name or context member is not over the accepted identifier alphabet.

  • SessionError – If an entry is malformed, a named member is missing from the scope, or a value already exists and force is false.

erase(*fields_to_erase: str, erase_dependent_also: bool = False, erase_all: bool = False) → EraseSummary[source]

Erase stored fields and the siblings from their producing kernel run.

Removes computed and ingested values while preserving parameters. Kernel outputs from the same execution group are erased together.

Parameters:
  • *fields_to_erase – Field names to erase. Required if erase_all is False.

  • erase_dependent_also – If True, also erases fields that depend on the specified fields.

  • erase_all – If True, erases all stored fields in scope. fields_to_erase must be empty.

Returns:

An EraseSummary naming the erased fields and the number of parameter entries that held at least one of them.

Raises:
  • ValueError – If neither fields_to_erase nor erase_all is specified, or if both are specified.

  • FieldNotFoundError – If a specified field is neither stored nor produced by a registered kernel.

export(*fields: FieldAddress, sources: str = 'all', export_format: str | None = None, expand_contextual: bool = True, shape: str = 'wide') → Any[source]

Unified export of metrics and aggregates.

This method provides a single interface for exporting both parameter metrics and aggregate values. Wide export can merge aggregate values into parameter entries as contextual fields. Long export emits one row per stored parameter field or aggregate member with join keys, run IDs when available, and separate scalar and array value columns.

A field name that neither a registered kernel produces nor any stored field matches raises; a known field with no values in the current scope is reported with a warning instead of being silently omitted. With sources=”all”, a field found in either source is served without complaint.

Parameters:
  • *fields – Field names, structured selectors, or references to either.

  • sources – Data sources to include - “metrics”, “aggregates”, or “all”.

  • export_format – Output format - “dict”, “json”, “pandas”, “polars”, “list”. Defaults to the configured [export] default_export_format.

  • expand_contextual – When True and sources=”all”, merge aggregate values into parameter entries as contextual field names in wide export.

  • shape – “wide” for parameter entries or “long” for tidy value rows. Long dictionary export maps column names to lists.

Returns:

Results in the specified format.

Raises:

KernelNotFoundError – If a requested field is neither producible by a registered kernel nor stored in the current scope.

class diffract.session.namespaces.VizNamespace(session_or_context: Session | SessionContext)[source]

Bases: object

Visualization API for Session.

Provides multiple ways to create visualizations:

  1. Simple methods (recommended for quick exploration):
    >>> session.viz.box(y="stable_rank", x="model_id")
    >>> session.viz.scatter(x="frob_norm", y="stable_rank")
    
  2. Plot objects (for Hydra configs and advanced customization):
    >>> from diffract.viz.plots.boxplot import BoxPlot
    >>> session.viz.draw(plot=BoxPlot(y="stable_rank", x="model_id"))
    
  3. Config files (for reproducible workflows):
    >>> session.viz.draw(config_path="plots/boxplot.yaml")
    
  4. Grid helpers (for subplot dashboards and bound grids):
    >>> session.viz.grid(subplots=[...])
    >>> session.viz.bound_grid(plot_template=..., row=..., col=...)
    
draw(*, plot: Any = None, config_path: str | Path | None = None, overrides: list[str] | None = None, theme: Theme | None = None, theme_path: str | Path | None = None) → Any[source]

Render a Plotly figure using the viz module.

Provide either plot (a Plot object) or config_path (a Hydra YAML file).

Parameters:
  • plot – A Plot instance to render.

  • config_path – Path to a Hydra YAML config file.

  • overrides – Hydra overrides to apply (only with config_path).

  • theme – A Theme instance to apply.

  • theme_path – Path to a YAML file with theme config.

box(*, y: str | FieldRef, x: str | FieldRef, title: str | None = None, value_filter: dict[str, tuple[str, Any]] | None = None, box_width: float = 0.5, boxpoints: Literal['all', 'outliers', False] = 'outliers', jitter_enabled: bool = False, jitter_width: float = 0.12, jitter_offset: float = -0.35, jitter_seed: int = 42, jitter_density_scale: bool = True, jitter_color: str | FieldRef | None = None, jitter_coloraxis_id: int | None = None, jitter_colorscale: str = 'Viridis', jitter_showscale: bool = True, jitter_cmin: float | None = None, jitter_cmax: float | None = None, jitter_colorbar_title: str | None = None, jitter_coloraxis_override: bool = False, x_title: str | None = None, x_showticklabels: bool = True, x_tickangle: int | None = None, x_tickfont_size: int | None = None, x_tickfont_family: str | None = None, x_tickfont_color: str | None = None, x_showgrid: bool = True, x_gridcolor: str | None = None, x_showline: bool = True, x_linecolor: str | None = None, y_title: str | None = None, y_showticklabels: bool = True, y_tickangle: int | None = None, y_tickfont_size: int | None = None, y_tickfont_family: str | None = None, y_tickfont_color: str | None = None, y_showgrid: bool = True, y_gridcolor: str | None = None, y_showline: bool = True, y_linecolor: str | None = None, y_range: tuple[float, float] | None = None, y_dtick: float | str | None = None, y_tick0: float | None = None, y_tickformat: str | None = None, y_zeroline: bool = False, y_zerolinecolor: str | None = None, marker_coloraxis_id: int | None = None, marker_colorscale: str = 'Viridis', marker_showscale: bool = True, marker_cmin: float | None = None, marker_cmax: float | None = None, marker_colorbar_title: str | None = None, marker_coloraxis_override: bool = False, marker_size: str | FieldRef | float | None = 6, marker_size_range: tuple[float, float] | None = None, marker_opacity: str | FieldRef | float | None = 0.7, marker_opacity_range: tuple[float, float] | None = None, marker_color: str | FieldRef | None = None, marker_symbol: str | FieldRef | None = None, theme: Theme | None = None, theme_path: str | Path | None = None) → go.Figure

Create a box plot.

Parameters:
  • self – The bound viz namespace providing the draw() method.

  • y – Field for vertical values (field name or FieldRef).

  • x – Field for categories (field name or FieldRef).

  • title – Figure title.

  • value_filter – Filter entries by field values.

  • box_width – Width of boxes.

  • boxpoints – Show points: “all”, “outliers”, or False.

  • jitter_enabled – Enable the jitter overlay of individual points.

  • jitter_width – Horizontal spread of the jitter overlay.

  • jitter_offset – Horizontal offset of the jitter overlay from the box.

  • jitter_seed – Random seed for the jitter overlay.

  • jitter_density_scale – Scale jitter spread by local point density.

  • jitter_color – Field or color for jitter points.

  • jitter_coloraxis_id – Shared color axis id for jitter points.

  • jitter_colorscale – Colorscale for jitter points.

  • jitter_showscale – Show the jitter colorbar.

  • jitter_cmin – Minimum value for jitter color mapping.

  • jitter_cmax – Maximum value for jitter color mapping.

  • jitter_colorbar_title – Title of the jitter colorbar.

  • jitter_coloraxis_override – Apply jitter styling to an existing shared axis.

  • x_title – X-axis title.

  • x_showticklabels – Show x-axis tick labels.

  • x_tickangle – Angle of x-axis tick labels.

  • x_tickfont_size – Font size of x-axis tick labels.

  • x_tickfont_family – Font family of x-axis tick labels.

  • x_tickfont_color – Font color of x-axis tick labels.

  • x_showgrid – Show x-axis grid lines.

  • x_gridcolor – Color of x-axis grid lines.

  • x_showline – Show the x-axis line.

  • x_linecolor – Color of the x-axis line.

  • y_title – Y-axis title.

  • y_showticklabels – Show y-axis tick labels.

  • y_tickangle – Angle of y-axis tick labels.

  • y_tickfont_size – Font size of y-axis tick labels.

  • y_tickfont_family – Font family of y-axis tick labels.

  • y_tickfont_color – Font color of y-axis tick labels.

  • y_showgrid – Show y-axis grid lines.

  • y_gridcolor – Color of y-axis grid lines.

  • y_showline – Show the y-axis line.

  • y_linecolor – Color of the y-axis line.

  • y_range – Y-axis value range.

  • y_dtick – Y-axis tick step.

  • y_tick0 – Y-axis starting tick.

  • y_tickformat – Y-axis tick format string.

  • y_zeroline – Show the y-axis zero line.

  • y_zerolinecolor – Color of the y-axis zero line.

  • marker_coloraxis_id – Shared color axis id for markers.

  • marker_colorscale – Colorscale for markers.

  • marker_showscale – Show the marker colorbar.

  • marker_cmin – Minimum value for marker color mapping.

  • marker_cmax – Maximum value for marker color mapping.

  • marker_colorbar_title – Title of the marker colorbar.

  • marker_coloraxis_override – Override the shared marker color axis.

  • marker_size – Field or fixed size for markers.

  • marker_size_range – Range to scale marker sizes into.

  • marker_opacity – Field or fixed opacity for markers.

  • marker_opacity_range – Range to scale marker opacity into.

  • marker_color – Field or color for markers.

  • marker_symbol – Field or symbol for markers.

  • theme – Theme to apply to the figure.

  • theme_path – Path to a theme file to apply to the figure.

Returns:

Plotly Figure.

Example

>>> session.viz.box(y="stable_rank", x="model_id", marker_color="layer_id")
grid(*, subplots: list[SubplotSpec], make_subplots_kwargs: dict[str, Any] | None = None, theme: Theme | None = None, theme_path: str | Path | None = None) → go.Figure

Create and render a GridPlot from explicit subplot specifications.

bound_grid(*, plot_template: Plot, row: GridAxisBind | None = None, col: GridAxisBind | None = None, cell_rules: list[GridCellRule] | None = None, title_template: str | None = None, make_subplots_kwargs: dict[str, Any] | None = None, base_session_filter: dict[str, Any] | None = None, base_value_filter: dict[str, tuple[str, Any]] | None = None, theme: Theme | None = None, theme_path: str | Path | None = None) → go.Figure

Create and render a bound grid generated from row/column axis binds.

For plot binds targeting FieldRef plot attributes, plain string bind values are automatically converted into FieldRef(field=…). The same conversion is applied to cell_rules[*].plot overrides.

violin(*, y: str | FieldRef, x: str | FieldRef, title: str | None = None, value_filter: dict[str, tuple[str, Any]] | None = None, points: Literal['all', 'outliers', False] = 'outliers', box_visible: bool = True, meanline_visible: bool = True, side: Literal['positive', 'negative', 'both'] = 'positive', bandwidth: float | None = None, jitter_enabled: bool = False, jitter_width: float = 0.12, jitter_offset: float = -0.35, jitter_seed: int = 42, jitter_density_scale: bool = True, jitter_color: str | FieldRef | None = None, jitter_coloraxis_id: int | None = None, jitter_colorscale: str = 'Viridis', jitter_showscale: bool = True, jitter_cmin: float | None = None, jitter_cmax: float | None = None, jitter_colorbar_title: str | None = None, jitter_coloraxis_override: bool = False, x_title: str | None = None, x_showticklabels: bool = True, x_tickangle: int | None = None, x_tickfont_size: int | None = None, x_tickfont_family: str | None = None, x_tickfont_color: str | None = None, x_showgrid: bool = True, x_gridcolor: str | None = None, x_showline: bool = True, x_linecolor: str | None = None, y_title: str | None = None, y_showticklabels: bool = True, y_tickangle: int | None = None, y_tickfont_size: int | None = None, y_tickfont_family: str | None = None, y_tickfont_color: str | None = None, y_showgrid: bool = True, y_gridcolor: str | None = None, y_showline: bool = True, y_linecolor: str | None = None, y_range: tuple[float, float] | None = None, y_dtick: float | str | None = None, y_tick0: float | None = None, y_tickformat: str | None = None, y_zeroline: bool = False, y_zerolinecolor: str | None = None, marker_coloraxis_id: int | None = None, marker_colorscale: str = 'Viridis', marker_showscale: bool = True, marker_cmin: float | None = None, marker_cmax: float | None = None, marker_colorbar_title: str | None = None, marker_coloraxis_override: bool = False, marker_size: str | FieldRef | float | None = 6, marker_size_range: tuple[float, float] | None = None, marker_opacity: str | FieldRef | float | None = 0.7, marker_opacity_range: tuple[float, float] | None = None, marker_color: str | FieldRef | None = None, marker_symbol: str | FieldRef | None = None, theme: Theme | None = None, theme_path: str | Path | None = None) → go.Figure

Create a violin plot.

Parameters:
  • self – The bound viz namespace providing the draw() method.

  • y – Field for vertical values (field name or FieldRef).

  • x – Field for categories (field name or FieldRef).

  • title – Figure title.

  • value_filter – Filter entries by field values.

  • points – Show points: “all”, “outliers”, or False.

  • box_visible – Show inner box.

  • meanline_visible – Show mean line.

  • side – Which side to draw: “positive”, “negative”, or “both”.

  • bandwidth – Violin kernel bandwidth (None = auto).

  • jitter_enabled – Enable the jitter overlay of individual points.

  • jitter_width – Horizontal spread of the jitter overlay.

  • jitter_offset – Horizontal offset of the jitter overlay from the violin.

  • jitter_seed – Random seed for the jitter overlay.

  • jitter_density_scale – Scale jitter spread by local point density.

  • jitter_color – Field or color for jitter points.

  • jitter_coloraxis_id – Shared color axis id for jitter points.

  • jitter_colorscale – Colorscale for jitter points.

  • jitter_showscale – Show the jitter colorbar.

  • jitter_cmin – Minimum value for jitter color mapping.

  • jitter_cmax – Maximum value for jitter color mapping.

  • jitter_colorbar_title – Title of the jitter colorbar.

  • jitter_coloraxis_override – Apply jitter styling to an existing shared axis.

  • x_title – X-axis title.

  • x_showticklabels – Show x-axis tick labels.

  • x_tickangle – Angle of x-axis tick labels.

  • x_tickfont_size – Font size of x-axis tick labels.

  • x_tickfont_family – Font family of x-axis tick labels.

  • x_tickfont_color – Font color of x-axis tick labels.

  • x_showgrid – Show x-axis grid lines.

  • x_gridcolor – Color of x-axis grid lines.

  • x_showline – Show the x-axis line.

  • x_linecolor – Color of the x-axis line.

  • y_title – Y-axis title.

  • y_showticklabels – Show y-axis tick labels.

  • y_tickangle – Angle of y-axis tick labels.

  • y_tickfont_size – Font size of y-axis tick labels.

  • y_tickfont_family – Font family of y-axis tick labels.

  • y_tickfont_color – Font color of y-axis tick labels.

  • y_showgrid – Show y-axis grid lines.

  • y_gridcolor – Color of y-axis grid lines.

  • y_showline – Show the y-axis line.

  • y_linecolor – Color of the y-axis line.

  • y_range – Y-axis value range.

  • y_dtick – Y-axis tick step.

  • y_tick0 – Y-axis starting tick.

  • y_tickformat – Y-axis tick format string.

  • y_zeroline – Show the y-axis zero line.

  • y_zerolinecolor – Color of the y-axis zero line.

  • marker_coloraxis_id – Shared color axis id for markers.

  • marker_colorscale – Colorscale for markers.

  • marker_showscale – Show the marker colorbar.

  • marker_cmin – Minimum value for marker color mapping.

  • marker_cmax – Maximum value for marker color mapping.

  • marker_colorbar_title – Title of the marker colorbar.

  • marker_coloraxis_override – Override the shared marker color axis.

  • marker_size – Field or fixed size for markers.

  • marker_size_range – Range to scale marker sizes into.

  • marker_opacity – Field or fixed opacity for markers.

  • marker_opacity_range – Range to scale marker opacity into.

  • marker_color – Field or color for markers.

  • marker_symbol – Field or symbol for markers.

  • theme – Theme to apply to the figure.

  • theme_path – Path to a theme file to apply to the figure.

Returns:

Plotly Figure.

Example

>>> session.viz.violin(y="weights_svals", x="model_id", jitter_enabled=True)
scatter(*, x: str | FieldRef, y: str | FieldRef, group_by: str | FieldRef | None = None, title: str | None = None, value_filter: dict[str, tuple[str, Any]] | None = None, x_title: str | None = None, x_showticklabels: bool = True, x_tickangle: int | None = None, x_tickfont_size: int | None = None, x_tickfont_family: str | None = None, x_tickfont_color: str | None = None, x_showgrid: bool = True, x_gridcolor: str | None = None, x_showline: bool = True, x_linecolor: str | None = None, x_range: tuple[float, float] | None = None, x_dtick: float | str | None = None, x_tick0: float | None = None, x_tickformat: str | None = None, x_zeroline: bool = False, x_zerolinecolor: str | None = None, y_title: str | None = None, y_showticklabels: bool = True, y_tickangle: int | None = None, y_tickfont_size: int | None = None, y_tickfont_family: str | None = None, y_tickfont_color: str | None = None, y_showgrid: bool = True, y_gridcolor: str | None = None, y_showline: bool = True, y_linecolor: str | None = None, y_range: tuple[float, float] | None = None, y_dtick: float | str | None = None, y_tick0: float | None = None, y_tickformat: str | None = None, y_zeroline: bool = False, y_zerolinecolor: str | None = None, marker_coloraxis_id: int | None = None, marker_colorscale: str = 'Viridis', marker_showscale: bool = True, marker_cmin: float | None = None, marker_cmax: float | None = None, marker_colorbar_title: str | None = None, marker_coloraxis_override: bool = False, marker_size: str | float | None = 6, marker_size_range: tuple[float, float] | None = None, marker_opacity: str | float | None = 0.7, marker_opacity_range: tuple[float, float] | None = None, marker_color: str | FieldRef | None = None, marker_symbol: str | FieldRef | None = None, theme: Theme | None = None, theme_path: str | Path | None = None) → go.Figure

Create a scatter plot.

Each entry becomes a point. group_by splits entries into separate traces.

Parameters:
  • self – The bound viz namespace providing the draw() method.

  • x – Field for horizontal values (field name or FieldRef).

  • y – Field for vertical values (field name or FieldRef).

  • title – Figure title.

  • value_filter – Filter entries by field values.

  • group_by – Field to group points into traces (field name or FieldRef or None).

  • x_title – X-axis title.

  • x_showticklabels – Show x-axis tick labels.

  • x_tickangle – Angle of x-axis tick labels.

  • x_tickfont_size – Font size of x-axis tick labels.

  • x_tickfont_family – Font family of x-axis tick labels.

  • x_tickfont_color – Font color of x-axis tick labels.

  • x_showgrid – Show x-axis grid lines.

  • x_gridcolor – Color of x-axis grid lines.

  • x_showline – Show the x-axis line.

  • x_linecolor – Color of the x-axis line.

  • x_range – X-axis value range.

  • x_dtick – X-axis tick step.

  • x_tick0 – X-axis starting tick.

  • x_tickformat – X-axis tick format string.

  • x_zeroline – Show the x-axis zero line.

  • x_zerolinecolor – Color of the x-axis zero line.

  • y_title – Y-axis title.

  • y_showticklabels – Show y-axis tick labels.

  • y_tickangle – Angle of y-axis tick labels.

  • y_tickfont_size – Font size of y-axis tick labels.

  • y_tickfont_family – Font family of y-axis tick labels.

  • y_tickfont_color – Font color of y-axis tick labels.

  • y_showgrid – Show y-axis grid lines.

  • y_gridcolor – Color of y-axis grid lines.

  • y_showline – Show the y-axis line.

  • y_linecolor – Color of the y-axis line.

  • y_range – Y-axis value range.

  • y_dtick – Y-axis tick step.

  • y_tick0 – Y-axis starting tick.

  • y_tickformat – Y-axis tick format string.

  • y_zeroline – Show the y-axis zero line.

  • y_zerolinecolor – Color of the y-axis zero line.

  • marker_coloraxis_id – Shared color axis id for markers.

  • marker_colorscale – Colorscale for markers.

  • marker_showscale – Show the marker colorbar.

  • marker_cmin – Minimum value for marker color mapping.

  • marker_cmax – Maximum value for marker color mapping.

  • marker_colorbar_title – Title of the marker colorbar.

  • marker_coloraxis_override – Override the shared marker color axis.

  • marker_size – Field or fixed size for markers.

  • marker_size_range – Range to scale marker sizes into.

  • marker_opacity – Field or fixed opacity for markers.

  • marker_opacity_range – Range to scale marker opacity into.

  • marker_color – Field or color for markers.

  • marker_symbol – Field or symbol for markers.

  • theme – Theme to apply to the figure.

  • theme_path – Path to a theme file to apply to the figure.

Returns:

Plotly Figure.

Example

>>> session.viz.scatter(
...     x="frob_norm",
...     y="stable_rank",
...     marker_color="model_id",
...     marker_size="layer_id",
... )
heatmap(*, z: str | FieldRef, x: str | FieldRef, y: str | FieldRef, title: str | None = None, value_filter: dict[str, tuple[str, Any]] | None = None, fill_value: float = float('nan'), show_text: bool = False, text_format: str = '.2f', text_font_size: int = 10, reverse_y: bool = True, x_title: str | None = None, x_showticklabels: bool = True, x_tickangle: int | None = None, x_tickfont_size: int | None = None, x_tickfont_family: str | None = None, x_tickfont_color: str | None = None, x_showgrid: bool = True, x_gridcolor: str | None = None, x_showline: bool = True, x_linecolor: str | None = None, x_categoryorder: str | None = None, x_categoryarray: list[str] | None = None, y_title: str | None = None, y_showticklabels: bool = True, y_tickangle: int | None = None, y_tickfont_size: int | None = None, y_tickfont_family: str | None = None, y_tickfont_color: str | None = None, y_showgrid: bool = True, y_gridcolor: str | None = None, y_showline: bool = True, y_linecolor: str | None = None, y_categoryorder: str | None = None, y_categoryarray: list[str] | None = None, heatmap_coloraxis_id: int | None = None, heatmap_colorscale: str = 'Viridis', heatmap_showscale: bool = True, heatmap_cmin: float | None = None, heatmap_cmax: float | None = None, heatmap_colorbar_title: str | None = None, heatmap_coloraxis_override: bool = False, theme: Theme | None = None, theme_path: str | Path | None = None) → go.Figure

Create a heatmap by pivoting a scalar field.

Parameters:
  • self – The bound viz namespace providing the draw() method.

  • z – Field for cell values (field name or FieldRef).

  • x – Field for columns (field name or FieldRef).

  • y – Field for rows (field name or FieldRef).

  • title – Figure title.

  • value_filter – Filter entries by field values.

  • fill_value – Value for missing (x, y) cells.

  • show_text – Show cell values as text.

  • text_format – Format string for text (e.g. “.2f”).

  • text_font_size – Font size for cell text.

  • reverse_y – Reverse y-axis so first row is at top.

  • x_title – X-axis title.

  • x_showticklabels – Show x-axis tick labels.

  • x_tickangle – Angle of x-axis tick labels.

  • x_tickfont_size – Font size of x-axis tick labels.

  • x_tickfont_family – Font family of x-axis tick labels.

  • x_tickfont_color – Font color of x-axis tick labels.

  • x_showgrid – Show x-axis grid lines.

  • x_gridcolor – Color of x-axis grid lines.

  • x_showline – Show the x-axis line.

  • x_linecolor – Color of the x-axis line.

  • x_categoryorder – Ordering strategy for x-axis categories.

  • x_categoryarray – Explicit ordering of x-axis categories.

  • y_title – Y-axis title.

  • y_showticklabels – Show y-axis tick labels.

  • y_tickangle – Angle of y-axis tick labels.

  • y_tickfont_size – Font size of y-axis tick labels.

  • y_tickfont_family – Font family of y-axis tick labels.

  • y_tickfont_color – Font color of y-axis tick labels.

  • y_showgrid – Show y-axis grid lines.

  • y_gridcolor – Color of y-axis grid lines.

  • y_showline – Show the y-axis line.

  • y_linecolor – Color of the y-axis line.

  • y_categoryorder – Ordering strategy for y-axis categories.

  • y_categoryarray – Explicit ordering of y-axis categories.

  • heatmap_coloraxis_id – Shared color axis id for the heatmap.

  • heatmap_colorscale – Colorscale for the heatmap.

  • heatmap_showscale – Show the heatmap colorbar.

  • heatmap_cmin – Minimum value for heatmap color mapping.

  • heatmap_cmax – Maximum value for heatmap color mapping.

  • heatmap_colorbar_title – Title of the heatmap colorbar.

  • heatmap_coloraxis_override – Override the shared heatmap color axis.

  • theme – Theme to apply to the figure.

  • theme_path – Path to a theme file to apply to the figure.

Returns:

Plotly Figure.

Example

>>> session.viz.heatmap(z="stable_rank", x="head_id", y="layer_id")
sparkline(*, y: str | FieldRef, x: str | FieldRef, group_by: str | FieldRef | None = None, title: str | None = None, value_filter: dict[str, tuple[str, Any]] | None = None, mode: Literal['lines', 'markers', 'lines+markers'] = 'lines', show_bands: bool = True, band_opacity: float = 0.3, band_line_width: float = 0.5, x_title: str | None = None, x_showticklabels: bool = True, x_tickangle: int | None = None, x_tickfont_size: int | None = None, x_tickfont_family: str | None = None, x_tickfont_color: str | None = None, x_showgrid: bool = True, x_gridcolor: str | None = None, x_showline: bool = True, x_linecolor: str | None = None, x_categoryorder: str | None = None, x_categoryarray: list[str] | None = None, x_range: tuple[float, float] | None = None, x_dtick: float | str | None = None, x_tick0: float | None = None, x_tickformat: str | None = None, x_zeroline: bool = False, x_zerolinecolor: str | None = None, x_axis_mode: Literal['numeric', 'categorical'] | None = None, y_title: str | None = None, y_showticklabels: bool = True, y_tickangle: int | None = None, y_tickfont_size: int | None = None, y_tickfont_family: str | None = None, y_tickfont_color: str | None = None, y_showgrid: bool = True, y_gridcolor: str | None = None, y_showline: bool = True, y_linecolor: str | None = None, y_range: tuple[float, float] | None = None, y_dtick: float | str | None = None, y_tick0: float | None = None, y_tickformat: str | None = None, y_zeroline: bool = False, y_zerolinecolor: str | None = None, line_coloraxis_id: int | None = None, line_colorscale: str = 'Viridis', line_showscale: bool = True, line_cmin: float | None = None, line_cmax: float | None = None, line_colorbar_title: str | None = None, line_coloraxis_override: bool = False, line_width: str | float | None = 2, line_width_range: tuple[float, float] | None = None, line_color: str | FieldRef | None = None, line_dash: str | FieldRef | None = None, line_shape: str | None = None, line_smoothing: float | None = None, marker_coloraxis_id: int | None = None, marker_colorscale: str = 'Viridis', marker_showscale: bool = True, marker_cmin: float | None = None, marker_cmax: float | None = None, marker_colorbar_title: str | None = None, marker_coloraxis_override: bool = False, marker_size: str | float | None = 6, marker_size_range: tuple[float, float] | None = None, marker_opacity: str | float | None = 0.7, marker_opacity_range: tuple[float, float] | None = None, marker_color: str | FieldRef | None = None, marker_symbol: str | FieldRef | None = None, theme: Theme | None = None, theme_path: str | Path | None = None) → go.Figure

Create a line plot of a field vs a metadata key.

Automatically computes mean and std for duplicate x values. Each group (group_by) becomes a separate line trace.

Parameters:
  • y – Field for vertical values (field name or FieldRef).

  • x – Field for horizontal axis (field name or FieldRef).

  • title – Figure title.

  • value_filter – Filter entries by field values.

  • group_by – Field to group series by (field name or FieldRef or None).

  • mode – “lines”, “markers”, or “lines+markers”.

  • show_bands – Show mean ± std bands.

  • band_opacity – Opacity of std band fill.

  • band_line_width – Line width for band edges.

  • self – The bound viz namespace providing the draw() method.

  • x_title – X-axis title.

  • x_showticklabels – Show x-axis tick labels.

  • x_tickangle – Angle of x-axis tick labels.

  • x_tickfont_size – Font size of x-axis tick labels.

  • x_tickfont_family – Font family of x-axis tick labels.

  • x_tickfont_color – Font color of x-axis tick labels.

  • x_showgrid – Show x-axis grid lines.

  • x_gridcolor – Color of x-axis grid lines.

  • x_showline – Show the x-axis line.

  • x_linecolor – Color of the x-axis line.

  • x_categoryorder – Ordering strategy for x-axis categories.

  • x_categoryarray – Explicit ordering of x-axis categories.

  • x_range – X-axis value range.

  • x_dtick – X-axis tick step.

  • x_tick0 – X-axis starting tick.

  • x_tickformat – X-axis tick format string.

  • x_zeroline – Show the x-axis zero line.

  • x_zerolinecolor – Color of the x-axis zero line.

  • x_axis_mode – Force the x-axis data type (“numeric” or “categorical”); inferred from the data when None.

  • y_title – Y-axis title.

  • y_showticklabels – Show y-axis tick labels.

  • y_tickangle – Angle of y-axis tick labels.

  • y_tickfont_size – Font size of y-axis tick labels.

  • y_tickfont_family – Font family of y-axis tick labels.

  • y_tickfont_color – Font color of y-axis tick labels.

  • y_showgrid – Show y-axis grid lines.

  • y_gridcolor – Color of y-axis grid lines.

  • y_showline – Show the y-axis line.

  • y_linecolor – Color of the y-axis line.

  • y_range – Y-axis value range.

  • y_dtick – Y-axis tick step.

  • y_tick0 – Y-axis starting tick.

  • y_tickformat – Y-axis tick format string.

  • y_zeroline – Show the y-axis zero line.

  • y_zerolinecolor – Color of the y-axis zero line.

  • line_coloraxis_id – Shared color axis id for lines.

  • line_colorscale – Colorscale for lines.

  • line_showscale – Show the line colorbar.

  • line_cmin – Minimum value for line color mapping.

  • line_cmax – Maximum value for line color mapping.

  • line_colorbar_title – Title of the line colorbar.

  • line_coloraxis_override – Override the shared line color axis.

  • line_width – Field or fixed width for lines.

  • line_width_range – Range to scale line widths into.

  • line_color – Field or color for lines.

  • line_dash – Field or dash style for lines.

  • line_shape – Line interpolation shape.

  • line_smoothing – Line smoothing factor.

  • marker_coloraxis_id – Shared color axis id for markers.

  • marker_colorscale – Colorscale for markers.

  • marker_showscale – Show the marker colorbar.

  • marker_cmin – Minimum value for marker color mapping.

  • marker_cmax – Maximum value for marker color mapping.

  • marker_colorbar_title – Title of the marker colorbar.

  • marker_coloraxis_override – Override the shared marker color axis.

  • marker_size – Field or fixed size for markers.

  • marker_size_range – Range to scale marker sizes into.

  • marker_opacity – Field or fixed opacity for markers.

  • marker_opacity_range – Range to scale marker opacity into.

  • marker_color – Field or color for markers.

  • marker_symbol – Field or symbol for markers.

  • theme – Theme to apply to the figure.

  • theme_path – Path to a theme file to apply to the figure.

Returns:

Plotly Figure.

Example

>>> session.viz.line(y="stable_rank", x="in_model_idx", group_by="model_id")
line(*, y: str | FieldRef, x: str | FieldRef, group_by: str | FieldRef | None = None, title: str | None = None, value_filter: dict[str, tuple[str, Any]] | None = None, mode: Literal['lines', 'markers', 'lines+markers'] = 'lines', show_bands: bool = True, band_opacity: float = 0.3, band_line_width: float = 0.5, x_title: str | None = None, x_showticklabels: bool = True, x_tickangle: int | None = None, x_tickfont_size: int | None = None, x_tickfont_family: str | None = None, x_tickfont_color: str | None = None, x_showgrid: bool = True, x_gridcolor: str | None = None, x_showline: bool = True, x_linecolor: str | None = None, x_categoryorder: str | None = None, x_categoryarray: list[str] | None = None, x_range: tuple[float, float] | None = None, x_dtick: float | str | None = None, x_tick0: float | None = None, x_tickformat: str | None = None, x_zeroline: bool = False, x_zerolinecolor: str | None = None, x_axis_mode: Literal['numeric', 'categorical'] | None = None, y_title: str | None = None, y_showticklabels: bool = True, y_tickangle: int | None = None, y_tickfont_size: int | None = None, y_tickfont_family: str | None = None, y_tickfont_color: str | None = None, y_showgrid: bool = True, y_gridcolor: str | None = None, y_showline: bool = True, y_linecolor: str | None = None, y_range: tuple[float, float] | None = None, y_dtick: float | str | None = None, y_tick0: float | None = None, y_tickformat: str | None = None, y_zeroline: bool = False, y_zerolinecolor: str | None = None, line_coloraxis_id: int | None = None, line_colorscale: str = 'Viridis', line_showscale: bool = True, line_cmin: float | None = None, line_cmax: float | None = None, line_colorbar_title: str | None = None, line_coloraxis_override: bool = False, line_width: str | float | None = 2, line_width_range: tuple[float, float] | None = None, line_color: str | FieldRef | None = None, line_dash: str | FieldRef | None = None, line_shape: str | None = None, line_smoothing: float | None = None, marker_coloraxis_id: int | None = None, marker_colorscale: str = 'Viridis', marker_showscale: bool = True, marker_cmin: float | None = None, marker_cmax: float | None = None, marker_colorbar_title: str | None = None, marker_coloraxis_override: bool = False, marker_size: str | float | None = 6, marker_size_range: tuple[float, float] | None = None, marker_opacity: str | float | None = 0.7, marker_opacity_range: tuple[float, float] | None = None, marker_color: str | FieldRef | None = None, marker_symbol: str | FieldRef | None = None, theme: Theme | None = None, theme_path: str | Path | None = None) → go.Figure

Create a line plot of a field vs a metadata key.

Automatically computes mean and std for duplicate x values. Each group (group_by) becomes a separate line trace.

Parameters:
  • y – Field for vertical values (field name or FieldRef).

  • x – Field for horizontal axis (field name or FieldRef).

  • title – Figure title.

  • value_filter – Filter entries by field values.

  • group_by – Field to group series by (field name or FieldRef or None).

  • mode – “lines”, “markers”, or “lines+markers”.

  • show_bands – Show mean ± std bands.

  • band_opacity – Opacity of std band fill.

  • band_line_width – Line width for band edges.

  • self – The bound viz namespace providing the draw() method.

  • x_title – X-axis title.

  • x_showticklabels – Show x-axis tick labels.

  • x_tickangle – Angle of x-axis tick labels.

  • x_tickfont_size – Font size of x-axis tick labels.

  • x_tickfont_family – Font family of x-axis tick labels.

  • x_tickfont_color – Font color of x-axis tick labels.

  • x_showgrid – Show x-axis grid lines.

  • x_gridcolor – Color of x-axis grid lines.

  • x_showline – Show the x-axis line.

  • x_linecolor – Color of the x-axis line.

  • x_categoryorder – Ordering strategy for x-axis categories.

  • x_categoryarray – Explicit ordering of x-axis categories.

  • x_range – X-axis value range.

  • x_dtick – X-axis tick step.

  • x_tick0 – X-axis starting tick.

  • x_tickformat – X-axis tick format string.

  • x_zeroline – Show the x-axis zero line.

  • x_zerolinecolor – Color of the x-axis zero line.

  • x_axis_mode – Force the x-axis data type (“numeric” or “categorical”); inferred from the data when None.

  • y_title – Y-axis title.

  • y_showticklabels – Show y-axis tick labels.

  • y_tickangle – Angle of y-axis tick labels.

  • y_tickfont_size – Font size of y-axis tick labels.

  • y_tickfont_family – Font family of y-axis tick labels.

  • y_tickfont_color – Font color of y-axis tick labels.

  • y_showgrid – Show y-axis grid lines.

  • y_gridcolor – Color of y-axis grid lines.

  • y_showline – Show the y-axis line.

  • y_linecolor – Color of the y-axis line.

  • y_range – Y-axis value range.

  • y_dtick – Y-axis tick step.

  • y_tick0 – Y-axis starting tick.

  • y_tickformat – Y-axis tick format string.

  • y_zeroline – Show the y-axis zero line.

  • y_zerolinecolor – Color of the y-axis zero line.

  • line_coloraxis_id – Shared color axis id for lines.

  • line_colorscale – Colorscale for lines.

  • line_showscale – Show the line colorbar.

  • line_cmin – Minimum value for line color mapping.

  • line_cmax – Maximum value for line color mapping.

  • line_colorbar_title – Title of the line colorbar.

  • line_coloraxis_override – Override the shared line color axis.

  • line_width – Field or fixed width for lines.

  • line_width_range – Range to scale line widths into.

  • line_color – Field or color for lines.

  • line_dash – Field or dash style for lines.

  • line_shape – Line interpolation shape.

  • line_smoothing – Line smoothing factor.

  • marker_coloraxis_id – Shared color axis id for markers.

  • marker_colorscale – Colorscale for markers.

  • marker_showscale – Show the marker colorbar.

  • marker_cmin – Minimum value for marker color mapping.

  • marker_cmax – Maximum value for marker color mapping.

  • marker_colorbar_title – Title of the marker colorbar.

  • marker_coloraxis_override – Override the shared marker color axis.

  • marker_size – Field or fixed size for markers.

  • marker_size_range – Range to scale marker sizes into.

  • marker_opacity – Field or fixed opacity for markers.

  • marker_opacity_range – Range to scale marker opacity into.

  • marker_color – Field or color for markers.

  • marker_symbol – Field or symbol for markers.

  • theme – Theme to apply to the figure.

  • theme_path – Path to a theme file to apply to the figure.

Returns:

Plotly Figure.

Example

>>> session.viz.line(y="stable_rank", x="in_model_idx", group_by="model_id")
class diffract.session.namespaces.UtilsNamespace(session_or_context: Session | SessionContext, parameter_repository: IParameterRepository = Provide['nn.parameter_repository'], aggregate_repository: AggregateRepository = Provide['nn.aggregate_repository'], parallel_context_factory: Callable[[], ParallelContext] = Provide['parallel_singleton.thread_pool_context.provider'])[source]

Bases: object

Utility operations API for Session.

merge_other_session(other_session_or_context: Session | SessionContext, fields: list[str] | None = None, *, verify: bool = True, read_budget_bytes: int = 512 * 1024 * 1024) → None[source]

Merge parameters from another session into this one.

Copies parameters and their computed fields from another session. When verify is True, handles conflicts by skipping duplicate fields.

Parameters:
  • other_session_or_context – Source session to merge from.

  • fields – Specific fields to merge. If None, merges all fields.

  • verify – If True, check for conflicts and skip duplicates.

  • read_budget_bytes – Maximum bytes to read during merge operation.

Example

>>> import numpy as np
>>> from diffract import Session
>>> with Session(profile="ram") as source, Session(profile="ram") as target:
...     _ = source.models.add({"weights": np.eye(2)}, model_id="net")
...     target.utils.merge_other_session(source)
...     target.models.list()
['net']