Skip to content

Plotting

PlotModel draws a model's network with Graphviz. It needs the viz extra and the Graphviz programs; see Inspecting a model.

PlotModel

PlotModel(model: object, filename: str | Path, plot_neuron_name: bool = False, view: bool = False, title: str | None = 'Self-organizing deep learning neural network')

Plot self-organizing neural network (multilayered GMDH)

Parameters:

Name Type Description Default
model SONN

The model to draw.

required
filename str or Path

Where plot writes, without the extension: the drawing goes to <filename>.svg and its Graphviz source to <filename>.

required
plot_neuron_name bool

Write each neuron's family into its box.

False
view bool

Open the drawing once it is written.

False
title str or None

The line at the top of the drawing. None or an empty string leaves it out.

"Self-organizing deep learning neural network"

title instance-attribute

title = title

custom palette

self.node_color = '#ccd1ff' self.io_node_color = '#bed4eb' self.io_pen_color = '#535ebe' self.pen_color = '#535ebe' self.io_font_color = 'black' self.connection_color = '#ccd1ff' self.connection_fill_color = '#535ebe'

add_connection

add_connection(layers: Sequence[object], neuron: object, neuron_idx: int, u_index: int) -> None

Add the edge into neuron_idx of neuron from its input u_index.

The source node is an input feature or a neuron of an earlier layer, as resolved from the neuron's input layout.

add_edge

add_edge(a: str, b: str) -> None

Add a directed edge from node a to node b.

plot

plot() -> None

Build the graph and render it to <filename>.svg.

Draws the input features, every neuron of every layer, their input edges and the readout (best neuron or out_proj head). Does nothing for a model with no layers.

Raises:

Type Description
RuntimeError

If the Graphviz dot executable is not on PATH.