OCDocker.OCScore.Analysis.Plotting.ArchitecturePlots module¶
Publication-oriented OCScore architecture diagrams.
Usage:
import OCDocker.OCScore.Analysis.Plotting.ArchitecturePlots as ocarchplot
- class OCDocker.OCScore.Analysis.Plotting.ArchitecturePlots.ArchitectureBlock(label, dim, kind, detail='')[source]¶
Bases:
objectSingle visible block in an architecture diagram.
- Parameters:
label (str)
dim (int | None)
kind (str)
detail (str)
- label¶
Text label shown in the block.
- Type:
str
- dim¶
Feature width or output dimensionality represented by the block.
- Type:
int or None
- kind¶
Visual role used for colors, such as
input,encoder, orhead.- Type:
str
- detail¶
Optional compact annotation shown below the dimensionality.
- Type:
str, default=””
- class OCDocker.OCScore.Analysis.Plotting.ArchitecturePlots.ArchitectureDiagram(task, main, auxiliary=(), notes=())[source]¶
Bases:
objectNormalized architecture diagram specification.
- Parameters:
task (str)
main (tuple[ArchitectureBlock, ...])
auxiliary (tuple[ArchitectureBlock, ...])
notes (tuple[str, ...])
- task¶
Name of the task or model family represented by the diagram.
- Type:
str
- main¶
Primary left-to-right model path.
- Type:
tuple of ArchitectureBlock
- auxiliary¶
Optional auxiliary branch, used for reconstruction decoders.
- Type:
tuple of ArchitectureBlock, default=()
- notes¶
Compact notes rendered below the diagram.
- Type:
tuple of str, default=()
- OCDocker.OCScore.Analysis.Plotting.ArchitecturePlots.load_architecture_document(source)[source]¶
Load an architecture document.
- Parameters:
source (str or pathlib.Path) – Architecture JSON/YAML file or a
best_model/export directory.- Returns:
Parsed architecture document and the resolved architecture file path.
- Return type:
tuple of dict and pathlib.Path
- Raises:
FileNotFoundError – If the source path or export architecture file does not exist.
ValueError – If the architecture file does not contain a mapping.
- OCDocker.OCScore.Analysis.Plotting.ArchitecturePlots.normalize_architecture(document)[source]¶
Normalize architecture metadata for plotting.
- Parameters:
document (Mapping) – Exported OCScore architecture document or a manual architecture mapping.
- Returns:
Diagram-ready architecture with primary and optional auxiliary blocks.
- Return type:
- Raises:
ValueError – If a manual
layerssection is present but is not a list.
- OCDocker.OCScore.Analysis.Plotting.ArchitecturePlots.plot_architecture_diagram(architecture, *, title=None, figsize=None, include_decoder=False)[source]¶
Build a publication-oriented neural-network architecture figure.
- Parameters:
architecture (Mapping or ArchitectureDiagram) – Architecture metadata or a pre-normalized diagram specification.
title (str, optional) – Custom title. When omitted, the task name is used.
figsize (tuple of float, optional) – Explicit matplotlib figure size.
include_decoder (bool, default=False) – Whether to include the auxiliary reconstruction decoder branch.
- Returns:
Figure and axes containing the rendered architecture diagram.
- Return type:
tuple of matplotlib.figure.Figure and matplotlib.axes.Axes
- Raises:
ValueError – If the architecture has no layers to plot.
- OCDocker.OCScore.Analysis.Plotting.ArchitecturePlots.save_architecture_figures(source, output_dir, *, formats=('png', 'svg', 'pdf'), dpi=220, title=None, basename='architecture', include_decoder=False)[source]¶
Save architecture figures to disk.
- Parameters:
source (str or pathlib.Path) – Architecture JSON/YAML file or
best_model/export directory.output_dir (str or pathlib.Path) – Directory where figure files will be written.
formats (sequence of str, default=("png", "svg", "pdf")) – Output formats accepted by matplotlib.
dpi (int, default=220) – Raster output resolution.
title (str, optional) – Custom figure title.
basename (str, default="architecture") – Output filename stem.
include_decoder (bool, default=False) – Whether to include the auxiliary reconstruction decoder branch.
- Returns:
Mapping from output format to absolute file path, plus
source.- Return type:
dict
- Raises:
ValueError – If no valid output format is provided.