Skip to content

Commit

Permalink
roll back changes
Browse files Browse the repository at this point in the history
  • Loading branch information
benofben committed Feb 14, 2023
1 parent 153d429 commit e93bd6d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 54 deletions.
94 changes: 42 additions & 52 deletions Lab 6 - Graph Data Science/embedding.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,15 @@
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "JAPoU8Sm5E6e"
},
"source": [
"<p>\n",
" <a href=\"https://colab.research.google.com/github/neo4j-partners/hands-on-lab-neo4j-and-vertex-ai/blob/main/Lab%205%20-%20Graph%20Data%20Science/embedding.ipynb\" target=\"_blank\">\n",
" <img src=\"https://cloud.google.com/ml-engine/images/colab-logo-32px.png\" alt=\"Colab logo\"> Run in Colab\n",
" </a>\n",
"</p>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "JtcD7PrPzSqE"
},
"source": [
"# Install Prerequisites\n",
"# Embedding\n",
"We're going to generate a graph embedding using Neo4j Graph Data Science (GDS). This will be an additional feature we can use to train our machine learning model later.\n",
"\n",
"## Install Prerequisites\n",
"First off, you'll also need to install a few packages."
]
},
Expand All @@ -41,12 +31,13 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "IdMFRbqGzSqF"
},
"source": [
"# Working with Neo4j\n",
"## Working with Neo4j\n",
"You'll need to enter the credentials from your Neo4j instance below. You can get these by running the command \":server connect\" in the Neo4j Browser. The default DB_USER and DB_NAME are always neo4j."
]
},
Expand All @@ -58,48 +49,23 @@
},
"outputs": [],
"source": [
"# Enter these Inputs!\n",
"CONN_URI = ''\n",
"while CONN_URI=='':\n",
" CONN_URI = input (\"Enter your Neo4j GDS connection URI (example: neo4j+s://xxx.databases.neo4j.io:7687): \")\n",
"DB_PASS=''\n",
"while DB_PASS=='':\n",
" DB_PASS = input (\"Enter your Neo4j Password: \")\n",
"DB_USER = 'neo4j'\n",
"print('Testing Connection...')\n",
"from graphdatascience import GraphDataScience\n",
"gds = GraphDataScience(CONN_URI, auth=(DB_USER, DB_PASS), aura_ds=True)\n",
"print('Connection Succeeded!')\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "hFwZUeZY0jd7"
},
"source": [
"We will start with a clean Graph Data Science (GDS). Let's drop the 'mygraph', if it exists."
"# Edit these variables!\n",
"DB_URL = \"neo4j+s://179072b1.databases.neo4j.io:7687\"\n",
"DB_PASS = \"Rtpkd5RvNXXeu_SUoDWEfSfZ3LjehgOq3A-sQv94h7c\"\n",
"\n",
"# You can leave these defaults\n",
"DB_USER = \"neo4j\"\n",
"DB_NAME = \"neo4j\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 179
},
"id": "_bxCuwC_0gWZ",
"outputId": "5c4f100a-20ad-48b8-a80c-00be46b5231d"
},
"metadata": {},
"outputs": [],
"source": [
"result = gds.run_cypher(\n",
" \"\"\"\n",
" CALL gds.graph.drop('mygraph',false)\n",
" \"\"\"\n",
")\n",
"display(result)"
"from graphdatascience import GraphDataScience\n",
"gds = GraphDataScience(CONN_URI, auth=(DB_USER, DB_PASS), aura_ds=True)"
]
},
{
Expand Down Expand Up @@ -144,6 +110,28 @@
"display(result)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Note, if you get an error saying the graph already exists, that's probably because you ran this code before. You can destroy it using this command:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"result = gds.run_cypher(\n",
" \"\"\"\n",
" CALL gds.graph.drop('mygraph',false)\n",
" \"\"\"\n",
")\n",
"display(result)"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down Expand Up @@ -346,12 +334,13 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "GeK8OgtiAC7f"
},
"source": [
"# Authenticate your Google Cloud Account\n",
"## Authenticate your Google Cloud Account\n",
"Now let's write the file to Google Cloud Storage so we can use it in our model. To do so, we must first authenticate.\n",
"\n",
"Edit the variables below. You can find the project ID in the Google Cloud Console. The STORAGE_BUCKET is the name of a new bucket. It must be globally unique. It also needs to be all lower case."
Expand Down Expand Up @@ -403,12 +392,13 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "Azb1inEVAC7f"
},
"source": [
"# Upload to Google Cloud Storage\n",
"## Upload to Google Cloud Storage\n",
"Now we can upload our data sets to our bucket."
]
},
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ If you have a Google Cloud account with permissions that allow you to invoke Ver
* [Lab 3 - Moving Data](Lab%203%20-%20Moving%20Data/README.md) (15 min)
* A Day of Data
* A Year of Data
* [Lab 4 - Exploration](Lab%204%20-%20Exploration/README.md) 15 min)
* [Lab 4 - Exploration](Lab%204%20-%20Exploration/README.md) 10 min)
* Exploration with Neo4j Bloom
* [Lab 5 - Vertex AI Workbench](Lab%205%20-%20Vertex%20AI%20Workbench/README.md) 15 min)
* [Lab 5 - Vertex AI Workbench](Lab%205%20-%20Vertex%20AI%20Workbench/README.md) 10 min)
* to do

* Break (10 min)
Expand Down

0 comments on commit e93bd6d

Please sign in to comment.