Skip to content

Commit 2b1cc64

Browse files
committed
Fix node embedding plots after rescaled PageRank
1 parent ca2df39 commit 2b1cc64

File tree

2 files changed

+69
-7
lines changed

2 files changed

+69
-7
lines changed

jupyter/NodeEmbeddingsJava.ipynb

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,37 @@
4545
"- [Complete guide to understanding Node2Vec algorithm](https://towardsdatascience.com/complete-guide-to-understanding-node2vec-algorithm-4e9a35e5d147)"
4646
]
4747
},
48+
{
49+
"cell_type": "code",
50+
"execution_count": null,
51+
"id": "43204131",
52+
"metadata": {},
53+
"outputs": [],
54+
"source": [
55+
"%%html\n",
56+
"<style>\n",
57+
"/* CSS style for smaller dataframe tables. */\n",
58+
".dataframe th {\n",
59+
" font-size: 8px;\n",
60+
"}\n",
61+
".dataframe td {\n",
62+
" font-size: 8px;\n",
63+
"}\n",
64+
"</style>"
65+
]
66+
},
67+
{
68+
"cell_type": "code",
69+
"execution_count": null,
70+
"id": "b23a5047",
71+
"metadata": {},
72+
"outputs": [],
73+
"source": [
74+
"# Main Colormap\n",
75+
"# main_color_map = 'nipy_spectral'\n",
76+
"main_color_map = 'viridis'"
77+
]
78+
},
4879
{
4980
"cell_type": "code",
5081
"execution_count": null,
@@ -65,7 +96,7 @@
6596
{
6697
"cell_type": "code",
6798
"execution_count": null,
68-
"id": "f8ef41ff",
99+
"id": "286cc436",
69100
"metadata": {},
70101
"outputs": [],
71102
"source": [
@@ -273,14 +304,14 @@
273304
"outputs": [],
274305
"source": [
275306
"def plot_2d_node_embeddings(node_embeddings_for_visualization: pd.DataFrame, title: str):\n",
276-
" if embeddings.empty:\n",
307+
" if node_embeddings_for_visualization.empty:\n",
277308
" print(\"No projected data to plot available\")\n",
278309
" return\n",
279310
"\n",
280311
" plot.scatter(\n",
281312
" x=node_embeddings_for_visualization.x,\n",
282313
" y=node_embeddings_for_visualization.y,\n",
283-
" s=node_embeddings_for_visualization.centrality * 300,\n",
314+
" s=node_embeddings_for_visualization.centrality * 60,\n",
284315
" c=node_embeddings_for_visualization.communityId,\n",
285316
" cmap=main_color_map,\n",
286317
" )\n",
@@ -494,7 +525,7 @@
494525
"pygments_lexer": "ipython3",
495526
"version": "3.12.9"
496527
},
497-
"title": "Object Oriented Design Quality Metrics for Java with Neo4j"
528+
"title": "Node Embeddings for Java with Neo4j"
498529
},
499530
"nbformat": 4,
500531
"nbformat_minor": 5

jupyter/NodeEmbeddingsTypescript.ipynb

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,37 @@
4848
{
4949
"cell_type": "code",
5050
"execution_count": null,
51+
"id": "15777c1b",
52+
"metadata": {},
53+
"outputs": [],
54+
"source": [
55+
"%%html\n",
56+
"<style>\n",
57+
"/* CSS style for smaller dataframe tables. */\n",
58+
".dataframe th {\n",
59+
" font-size: 8px;\n",
60+
"}\n",
61+
".dataframe td {\n",
62+
" font-size: 8px;\n",
63+
"}\n",
64+
"</style>"
65+
]
66+
},
67+
{
68+
"cell_type": "code",
69+
"execution_count": null,
70+
"id": "8b650672",
71+
"metadata": {},
72+
"outputs": [],
73+
"source": [
74+
"# Main Colormap\n",
75+
"# main_color_map = 'nipy_spectral'\n",
76+
"main_color_map = 'viridis'"
77+
]
78+
},
79+
{
80+
"cell_type": "code",
81+
"execution_count": 1,
5182
"id": "4191f259",
5283
"metadata": {},
5384
"outputs": [],
@@ -273,14 +304,14 @@
273304
"outputs": [],
274305
"source": [
275306
"def plot_2d_node_embeddings(node_embeddings_for_visualization: pd.DataFrame, title: str):\n",
276-
" if embeddings.empty:\n",
307+
" if node_embeddings_for_visualization.empty:\n",
277308
" print(\"No projected data to plot available\")\n",
278309
" return\n",
279310
"\n",
280311
" plot.scatter(\n",
281312
" x=node_embeddings_for_visualization.x,\n",
282313
" y=node_embeddings_for_visualization.y,\n",
283-
" s=node_embeddings_for_visualization.centrality * 300,\n",
314+
" s=node_embeddings_for_visualization.centrality * 60,\n",
284315
" c=node_embeddings_for_visualization.communityId,\n",
285316
" cmap=main_color_map,\n",
286317
" )\n",
@@ -497,7 +528,7 @@
497528
"pygments_lexer": "ipython3",
498529
"version": "3.12.9"
499530
},
500-
"title": "Object Oriented Design Quality Metrics for Java with Neo4j"
531+
"title": "Node Embeddings for Typescript with Neo4j"
501532
},
502533
"nbformat": 4,
503534
"nbformat_minor": 5

0 commit comments

Comments
 (0)