Skip to content

Commit

Permalink
Going to 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasonjo committed Feb 1, 2023
1 parent f90f12e commit 3a04a7c
Show file tree
Hide file tree
Showing 11 changed files with 12,948 additions and 21,826 deletions.
5,290 changes: 2,098 additions & 3,192 deletions Countries_of_the_world/Countries of the world analysis.ipynb

Large diffs are not rendered by default.

6,523 changes: 3,265 additions & 3,258 deletions GDS_Multigraph/GDS multigraph.ipynb

Large diffs are not rendered by default.

1,298 changes: 622 additions & 676 deletions Game_of_thrones_community_iteration/Game of thrones community iteration.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3,714 changes: 0 additions & 3,714 deletions debug/node2vec.ipynb

This file was deleted.

120 changes: 68 additions & 52 deletions fraud/p2p-fraud.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"### Prepare the Neo4j environment\n",
"\n",
"We will be using Neo4j as the source of truth to train the ML model. Therefore, I suggest you download and install the [Neo4j Desktop application](https://neo4j.com/download/) if you want to follow along with the code examples.\n",
"The dataset is available as a database dump. It is a variation of the database dump available on Neo4j's [product example GitHub to showcase fraud detection](https://github.com/neo4j-product-examples/demo-fraud-detection-with-p2p). I have added the fraud risk labels as described in the [second part of the Exploring fraud detection series](https://neo4j.com/developer-blog/exploring-fraud-detection-neo4j-graph-data-science-part-2/), so you don't have to deal with it. You can download the updated database dump by clicking on [this link](https://drive.google.com/file/d/1_N_QLtCRI-eeLzjEIFZAbj8YQrWfTolI/view?usp=sharing).\n",
"The dataset is available as a database dump. It is a variation of the database dump available on Neo4j's [product example GitHub to showcase fraud detection](https://github.com/neo4j-product-examples/demo-fraud-detection-with-p2p). I have added the fraud risk labels as described in the [second part of the Exploring fraud detection series](https://neo4j.com/developer-blog/exploring-fraud-detection-neo4j-graph-data-science-part-2/), so you don't have to deal with it. You can download the updated database dump by clicking on [this link](https://drive.google.com/file/d/1apR3xwWEOdi_WKmIAGk1bPqhHQSgxwT-/view?usp=sharing).\n",
"I've written a [post about restoring a database dump in Neo4j Desktop](https://tbgraph.wordpress.com/2020/11/11/dump-and-load-a-database-in-neo4j-desktop/) sometime ago if you need some help. After you have restored the database dump, you will also need to install the Graph Data Science and APOC libraries. Make sure you are using version 2.0.0 of the GDS or later.\n",
"\n",
"### Neo4j Graph Data Science Python client\n",
Expand All @@ -40,7 +40,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2.1.4\n"
"2.3.0\n"
]
}
],
Expand All @@ -49,7 +49,7 @@
"\n",
"host = \"bolt://localhost:7687\"\n",
"user = \"neo4j\"\n",
"password= \"letmein\"\n",
"password= \"pleaseletmein\"\n",
"\n",
"gds = GraphDataScience(host, auth=(user, password))\n",
"\n",
Expand Down Expand Up @@ -121,7 +121,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "5381aec2",
"metadata": {},
"outputs": [],
Expand All @@ -143,9 +143,9 @@
" \n",
"RETURN u.guid AS user_id,\n",
" u.fraudRisk AS fraudRisk,\n",
" size((u)-[:USED]->()) AS numberOfDevices,\n",
" size((u)-[:HAS_CC]->()) AS numberOfCCs,\n",
" size((u)-[:HAS_IP]->()) AS numberOfIps,\n",
" count{ (u)-[:USED]->() } AS numberOfDevices,\n",
" count{ (u)-[:HAS_CC]->() } AS numberOfCCs,\n",
" count{ (u)-[:HAS_IP]->() } AS numberOfIps,\n",
" coalesce(totalOutgoingAmount, 0) AS totalOutgoingAmount, \n",
" coalesce(avgOutgoingAmount, 0) AS avgOutgoingAmount,\n",
" coalesce(maxOutgoingAmount, 0) AS maxOutgoingAmount,\n",
Expand All @@ -159,7 +159,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"id": "3ca0b417",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -314,7 +314,7 @@
"4 200.00 2 "
]
},
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -333,7 +333,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"id": "66632cba",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -383,7 +383,7 @@
"1 1 211"
]
},
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -402,7 +402,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"id": "74048cdd",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -608,7 +608,7 @@
"max 6750.000000 564.000000 "
]
},
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -629,7 +629,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"id": "cb367423",
"metadata": {},
"outputs": [
Expand All @@ -639,7 +639,7 @@
"<AxesSubplot:>"
]
},
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
},
Expand Down Expand Up @@ -681,7 +681,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"id": "d3abee73",
"metadata": {},
"outputs": [],
Expand All @@ -698,7 +698,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"id": "2b049b2f",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -746,7 +746,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 12,
"id": "19e86468",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -824,10 +824,25 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 13,
"id": "dc970138",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ef751e6905144d54a17f4adebc534a68",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Loading: 0%| | 0/100 [00:00<?, ?%/s]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"G, res = gds.graph.project('fraud', ['User', 'Card'], \n",
" {'HAS_CC':{\n",
Expand Down Expand Up @@ -872,7 +887,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 14,
"id": "d55901cc",
"metadata": {},
"outputs": [],
Expand All @@ -892,7 +907,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 15,
"id": "88b655c2",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -924,27 +939,27 @@
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0</td>\n",
" <td>765184</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1</td>\n",
" <td>765185</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2</td>\n",
" <td>765186</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>3</td>\n",
" <td>765187</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>4</td>\n",
" <td>765188</td>\n",
" <td>4</td>\n",
" </tr>\n",
" </tbody>\n",
Expand All @@ -953,14 +968,14 @@
],
"text/plain": [
" nodeId componentId\n",
"0 0 0\n",
"1 1 1\n",
"2 2 2\n",
"3 3 3\n",
"4 4 4"
"0 765184 0\n",
"1 765185 1\n",
"2 765186 2\n",
"3 765187 3\n",
"4 765188 4"
]
},
"execution_count": 14,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -979,7 +994,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 16,
"id": "e97c1869",
"metadata": {},
"outputs": [],
Expand All @@ -1000,7 +1015,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 17,
"id": "340f4bf1",
"metadata": {},
"outputs": [],
Expand All @@ -1025,7 +1040,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 18,
"id": "9983c200",
"metadata": {},
"outputs": [],
Expand All @@ -1051,7 +1066,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 19,
"id": "9d41c3aa",
"metadata": {},
"outputs": [],
Expand All @@ -1073,7 +1088,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 20,
"id": "3a86c2e3",
"metadata": {},
"outputs": [],
Expand All @@ -1096,7 +1111,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 21,
"id": "0b914683",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -1167,28 +1182,29 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 22,
"id": "ccd028fd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"graphName fraud\n",
"database neo4j\n",
"memoryUsage \n",
"sizeInBytes -1\n",
"nodeCount 152550\n",
"relationshipCount 171201\n",
"configuration {'relationshipProjection': {'HAS_CC': {'orient...\n",
"density 0.000007\n",
"creationTime 2022-06-29T11:32:01.574618000+02:00\n",
"modificationTime 2022-06-29T11:32:01.917006000+02:00\n",
"schema {'graphProperties': {}, 'relationships': {'HAS...\n",
"graphName fraud\n",
"database neo4j\n",
"memoryUsage \n",
"sizeInBytes -1\n",
"nodeCount 152550\n",
"relationshipCount 171201\n",
"configuration {'relationshipProjection': {'HAS_CC': {'orient...\n",
"density 0.000007\n",
"creationTime 2023-02-01T13:10:50.719251667+01:00\n",
"modificationTime 2023-02-01T13:10:51.453140320+01:00\n",
"schema {'graphProperties': {}, 'relationships': {'HAS...\n",
"schemaWithOrientation {'graphProperties': {}, 'relationships': {'HAS...\n",
"Name: 0, dtype: object"
]
},
"execution_count": 21,
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
Loading

0 comments on commit 3a04a7c

Please sign in to comment.