| |
- ceil(x, /)
- Return the ceiling of x as an Integral.
This is the smallest integer >= x.
- display_daft_model(model: pgmpy.models.BayesianNetwork.BayesianNetwork, figsize: tuple = (2, 2)) -> daft.PGM
- Plots a small-format directed acyclic graph with black-and-white nodes that can be positioned
Args:
model (BayesianNetwork): The model to be drawn which must implement an edges collection
pos (dict, optional): A dictionary with nodes as keys and positions as values. Each value is a list containing an X and Y co-ordinate. If not specified a spring layout positioning will be computed. Defaults to None (automatic layout).
figsize (tuple, optional): Sets the figure size. If None default (small) sizing is used. Defaults to (2, 2).
Example:
>>> from pgmpy.models import BayesianNetwork
>>> domain_model = BayesianNetwork([('Vaccination?', 'Reaction?'), ('Vaccination?', 'Smallpox?'), ('Reaction?', 'Death?'), ('Smallpox?', 'Death?')])
>>> plot_daft_model(domain_model, pos=POS)
- display_networkx_model(model: pgmpy.models.BayesianNetwork.BayesianNetwork, pos: dict = None, figsize: tuple = (10, 8), node_size: int = 5000, auto_layout_cols: int = 0)
- Plots a large-format directed acyclic graph with coloured nodes that can be sized and positioned
Args:
model (BayesianNetwork): The model to be drawn which must implement an edges collection
pos (dict, optional): A dictionary with nodes as keys and positions as values. Each value is a list containing an X and Y co-ordinate. If not specified a spring layout positioning will be computed. Defaults to None (automatic layout).
figsize (tuple, optional): The size of the displayed plot. Defaults to (10, 8).
node_size (int, optional): The size of the nodes in the plot. Defaults to 5000.
auto_layout_cols (int, optional): If set > 0 an auto-layout is generated with the specified number of columns. Defaults to 0.
Example:
>>> from pgmpy.models import BayesianNetwork
>>> POS : dict = {'Vaccination?': [0, 1], 'Reaction?': [-1, 0], 'Smallpox?': [1, 0], 'Death?': [0, -1]}
>>> domain_model = BayesianNetwork([('Vaccination?', 'Reaction?'), ('Vaccination?', 'Smallpox?'), ('Reaction?', 'Death?'), ('Smallpox?', 'Death?')])
>>> plot_model(model=domain_model, pos=POS)
- display_pyvis_model(model: pgmpy.models.BayesianNetwork.BayesianNetwork, figsize: tuple = (500, 500), notebook: bool = True, enable_physics: bool = False, hierarchical: bool = False, filename: str = 'pyvis.html') -> IPython.lib.display.IFrame
- Displays a fully interactive directed acyclic graph that can either be embedded in a Jupyter Notebook cell or displayed in a new browser window
Args:
model (BayesianNetwork): The model to be drawn which must implement an edges collection
figsize (tuple, optional): The size of the displayed plot. Defaults to (10, 8)
notebook (bool, optional): If True the graph is displayed inside a Jupyter Notebook cell, if false it is launched in a separate browser window. Defaults to True
enable_physics (bool, optional): If True the nodes "jiggle" when they are dragged which looks really neat but it can mean that it is difficult to get a good lauout. False turns the "jiggle" off. Defaults to False.
filename (str, optional): The temporary filename used to save and store the HTML output. Defaults to "pyvis.html"
Returns:
IFrame: An IFrame is returned if notebook = True so that it can be embedded in the Jupyter Notebook cell. If notebook = False there is no return value as the graph is rendered in a separate browser window
Examples:
>>> from pgmpy.models import BayesianNetwork
>>> domain_model = BayesianNetwork([('Vaccination?', 'Reaction?'), ('Vaccination?', 'Smallpox?'), ('Reaction?', 'Death?'), ('Smallpox?', 'Death?')])
>>> # Display within the Jupyter Notebook cell
>>> display_pyvis_model(model=model)
>>> # Display in a new browser window (including all menus)
>>> display_pyvis_model(model=model, notebook=False)
>>> # Display within the Jupyter Notebook cell and make the default size larger by 50%
>>> display_pyvis_model(model=model, figsize=(750, 750))
|