tfds.visualization.GraphVisualizer
Stay organized with collections
Save and categorize content based on your preferences.
Visualizer for graph prediction datasets.
Inherits From: Visualizer
Methods
match
View source
match(
ds_info: dataset_info.DatasetInfo
) -> bool
Checks whether this dataset can be visualized with this visualizer.
See base class for more information.
Args:
ds_info: Metadata for the dataset.
Returns |
boolean value indicating whether the current visualizer can be used.
|
show
View source
show(
ds: tf.data.Dataset,
ds_info: dataset_info.DatasetInfo,
node_label_fn: Optional[_GraphFn] = None,
node_color_fn: Optional[_GraphFn] = None,
edge_color_fn: Optional[_GraphFn] = None,
rows: int = 3,
cols: int = 3,
plot_scale: float = 5,
**kwargs
)
Display the dataset.
Args |
ds
|
tf.data.Dataset . The tf.data.Dataset object to visualize. Examples
should not be batched. Examples will be consumed in order until (rows *
cols) are read or the dataset is consumed.
|
ds_info
|
tfds.core.DatasetInfo object of the dataset to visualize.
|
node_label_fn
|
A callable that maps individual graph examples to a
dictionary of node labels, rendered within the nodes.
|
node_color_fn
|
A callable that maps individual graph examples to a
dictionary of node colors.
|
edge_color_fn
|
A callable that maps individual graph examples to a
dictionary of edge colors.
|
rows
|
int , number of rows of the display grid.
|
cols
|
int , number of columns of the display grid.
|
plot_scale
|
float , controls the plot size of the images. Keep this value
around 5 to get a good plot. High and low values may cause the labels to
get overlapped.
|
**kwargs
|
Additional arguments passed to networkx.draw_networkx().
|
Returns |
fig
|
The pyplot figure.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tfds.visualization.GraphVisualizer\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/datasets/blob/v4.9.3/tensorflow_datasets/core/visualization/graph_visualizer.py#L60-L152) |\n\nVisualizer for graph prediction datasets.\n\nInherits From: [`Visualizer`](../../tfds/visualization/Visualizer)\n\nMethods\n-------\n\n### `match`\n\n[View source](https://github.com/tensorflow/datasets/blob/v4.9.3/tensorflow_datasets/core/visualization/graph_visualizer.py#L63-L74) \n\n match(\n ds_info: dataset_info.DatasetInfo\n ) -\u003e bool\n\nChecks whether this dataset can be visualized with this visualizer.\n\nSee base class for more information.\nArgs:\nds_info: Metadata for the dataset.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| boolean value indicating whether the current visualizer can be used. ||\n\n\u003cbr /\u003e\n\n### `show`\n\n[View source](https://github.com/tensorflow/datasets/blob/v4.9.3/tensorflow_datasets/core/visualization/graph_visualizer.py#L76-L152) \n\n show(\n ds: tf.data.Dataset,\n ds_info: dataset_info.DatasetInfo,\n node_label_fn: Optional[_GraphFn] = None,\n node_color_fn: Optional[_GraphFn] = None,\n edge_color_fn: Optional[_GraphFn] = None,\n rows: int = 3,\n cols: int = 3,\n plot_scale: float = 5,\n **kwargs\n )\n\nDisplay the dataset.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `ds` | [`tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset). The tf.data.Dataset object to visualize. Examples should not be batched. Examples will be consumed in order until (rows \\* cols) are read or the dataset is consumed. |\n| `ds_info` | [`tfds.core.DatasetInfo`](../../tfds/core/DatasetInfo) object of the dataset to visualize. |\n| `node_label_fn` | A callable that maps individual graph examples to a dictionary of node labels, rendered within the nodes. |\n| `node_color_fn` | A callable that maps individual graph examples to a dictionary of node colors. |\n| `edge_color_fn` | A callable that maps individual graph examples to a dictionary of edge colors. |\n| `rows` | `int`, number of rows of the display grid. |\n| `cols` | `int`, number of columns of the display grid. |\n| `plot_scale` | `float`, controls the plot size of the images. Keep this value around 5 to get a good plot. High and low values may cause the labels to get overlapped. |\n| `**kwargs` | Additional arguments passed to networkx.draw_networkx(). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|-------|--------------------|\n| `fig` | The pyplot figure. |\n\n\u003cbr /\u003e"]]