Skip to content

Commit 5bf5d5e

Browse files
raphael-intuglesujayintugle
authored andcommitted
added plot instructions to visualize semantic model
1 parent b63321e commit 5bf5d5e

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

docsite/docs/core-concepts/semantic-intelligence/link-prediction.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,19 @@ After running the prediction, you can visualize the discovered relationships as
9898
# This will render a graph of the relationships
9999
predictor.show_graph()
100100
```
101+
102+
:::note For Non-Interactive Environments
103+
The `show_graph()` method is designed for interactive environments like Jupyter notebooks where a GUI is available to display the plot.
104+
105+
If you run this method in a non-interactive script, you will see a `UserWarning` because no interactive backend is available. To save the graph to a file instead, you can use `matplotlib`:
106+
107+
```python
108+
import matplotlib.pyplot as plt
109+
110+
# This will generate the plot and raise a warning
111+
predictor.show_graph()
112+
113+
# This will save the generated plot to a file
114+
plt.savefig("link_prediction_graph.png")
115+
```
116+
:::

docsite/docs/core-concepts/semantic-intelligence/semantic-model.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,20 @@ After the link prediction stage has run, you can visualize the connections betwe
177177
sm.visualize()
178178
```
179179

180-
This will render a graph where each node represents a table and each edge represents a discovered link between them, providing a clear, high-level view of your data's structure.
180+
This will render a graph where each node represents a table and each edge represents a discovered link between them, providing a clear, high-level view of your data's structure.
181+
182+
:::note For Non-Interactive Environments
183+
The `sm.visualize()` method is designed for interactive environments like Jupyter notebooks where a GUI is available to display the plot.
184+
185+
If you run this method in a non-interactive script, you will see a `UserWarning` because no interactive backend is available. To save the graph to a file instead, you can use `matplotlib`:
186+
187+
```python
188+
import matplotlib.pyplot as plt
189+
190+
# This will generate the plot and raise a warning
191+
sm.visualize()
192+
193+
# This will save the generated plot to a file
194+
plt.savefig("semantic_model.png")
195+
```
196+
:::

0 commit comments

Comments
 (0)