neuralogic.utils.visualize

draw(drawer, obj, filename: str | None = None, show=True, img_type='png', *args, **kwargs)[source]
draw_grounding(grounding, filename: str | None = None, show=True, img_type='png', value_detail: int = 0, graphviz_path: str | None = None, *args, **kwargs)[source]
Draws sample’s grounding either as an image of type img_type either into:
  • a file - if filename is specified),

  • an IPython Image or Image popup - if show is True

  • or bytes otherwise

Parameters:
  • sample

  • filename

  • show

  • img_type

  • value_detail

  • graphviz_path

  • args

  • kwargs

Returns:

draw_model(model, filename: str | None = None, show=True, img_type='png', value_detail: int = 0, graphviz_path: str | None = None, *args, **kwargs)[source]
Draws model either as an image of type img_type either into:
  • a file - if filename is specified),

  • an IPython Image or Image popup - if show is True

  • or bytes otherwise

Parameters:
  • model

  • filename

  • show

  • img_type

  • value_detail

  • graphviz_path

  • args

  • kwargs

Returns:

draw_sample(sample, filename: str | None = None, show=True, img_type='png', value_detail: int = 0, graphviz_path: str | None = None, *args, **kwargs)[source]
Draws sample either as an image of type img_type either into:
  • a file - if filename is specified),

  • an IPython Image or Image popup - if show is True

  • or bytes otherwise

Parameters:
  • sample

  • filename

  • show

  • img_type

  • value_detail

  • graphviz_path

  • show

  • args

  • kwargs

Returns:

get_drawing_settings(img_type: str = 'png', value_detail: int = 0, graphviz_path: str | None = None) SettingsProxy[source]

Returns the default settings instance for drawing with a specified image type.

Parameters:
  • img_type

  • value_detail

  • graphviz_path

Returns:

get_graphviz_path(path: str | None = None) str[source]

Get the path to the Graphviz executable

get_grounding_drawer(settings: SettingsProxy)[source]
get_sample_drawer(settings: SettingsProxy)[source]
get_template_drawer(settings: SettingsProxy)[source]
is_jupyter() bool[source]
model_to_dot_source(model) str[source]

Renders the model into its dot source representation.

Parameters:

model

Returns:

sample_to_dot_source(sample, value_detail: int = 0) str[source]

Renders the sample into its dot source representation.

Parameters:
  • sample

  • value_detail

Returns:

to_dot_source(drawer, obj) str[source]