Visualization

For educational purposes, the following module can be used to visualize dense SPNs.

libspn_keras.visualize.visualize_dense_spn(dense_spn, show_legend=False, show_padding=True, transparent=False, node_size=30)

Visualize dense SPN.

The dense SPN must consist of DenseSum, DenseProduct, RootSum and leaf layers.

Parameters
  • dense_spn (Model) – An SPN of type tensorflow.keras.Sequential

  • show_legend (bool) – Whether to show legend of scopes and layers on the right

  • show_padding (bool) – Whether to show padded nodes

  • transparent (bool) – If True, the background is transparent.

  • node_size (int) – Size of the nodes drawn in the graph. Adjust to avoid clutter.

Return type

Figure

Returns

A plotly.graph_objects.Figure instance. Use .show() to render the visualization.