Community Detection (TastyBites)
Detect customer communities with graph algorithms, Louvain clustering, and 3D visualizations—right inside Snowflake using RelationalAI.
Download the Sample NotebookInstructions
Section titled “Instructions”Follow these steps to run the sample notebook using Snowflake Notebooks.
-
Log in to Snowflake at app.snowflake.com.
-
Import the notebook into Snowflake.
- Click on the + Create button in the top left corner of the Snowflake interface.
- Select Notebook from the dropdown menu.
- In the popover menu, click on the Import .ipynb File option.
- (Not pictured) Select the downloaded notebook file in the file picker dialog, then click Open.
-
Configure the notebook resources.
-
Choose a name for your notebook.
-
Select the database and schema where you want to save the notebook.
-
Select the Run on container Python environment.
-
Choose the Snowflake ML Runtime CPU 1.0 runtime.
-
Choose the compute pool you want to use for the notebook’s Python kernel.
No compute pool? See how to set one up.
-
Choose the warehouse you want to use to execute the notebook’s SQL queries.
No warehouse? See how to set one up.
-
Click the Create button to create and open the notebook.
-
(Not pictured) Follow the instructions in the notebook to run the code cells and explore the sample data.
-
Follow these steps to run the sample notebook using Python and Jupyter installed in a your local machine.
-
Ensure you have a compatible version of Python.
RelationalAI supports Python 3.9, 3.10, and 3.11. To check your current Python version, run the following command in your terminal:
Terminal window python --versionTerminal window python3 --versionIf you don’t have a compatible version of Python, you’ll need to install one.
How to install a compatible version of Python.
Select your operating system and follow the steps to install Python on your machine:
-
Navigate to the Python 3.11 download page, scroll down to the Files section, and download the Windows installer (64-bit).
-
Open the installer and follow the prompts to install Python 3.11. Check the box to add Python to your
PATH
. -
Open a terminal and verify that Python 3.11 is installed by running:
Terminal window python --versionThe output should be similar to
Python 3.11.9
.
-
Navigate to the Python 3.11 download page, scroll down to the Files section, and download the macOS 64-bit universal2 installer.
-
Open the installer and follow the prompts to install Python 3.11. Use the default installation options. When the installation is complete, double click the Install Certificates command in the Finder window.
-
Open a terminal and verify that Python 3.11 is installed by running:
Terminal window python3.11 --versionThe output should be similar to
Python 3.11.9
.
-
Use your distribution’s package manager to install Python 3.11. Alternatively, navigate to the Python 3.11 download page, scroll down to the Files section, download the Gzipped source tarball and compile it yourself. See the Python documentation for details.
-
Open a terminal and verify that Python 3.11 is installed by running:
Terminal window python3.11 --versionThe output should be similar to
Python 3.11.9
.
-
-
Create a project folder.
Terminal window mkdir ~/rai-sample-notebookscd ~/rai-sample-notebooks -
Move the downloaded notebook into your project folder.
Use the button at the top of this page to download the notebook file, then move it into your project folder.
-
Create a virtual environment and install Jupyter.
Terminal window python -m venv venvvenv\Scripts\activatepython -m pip install --upgrade pippython -m pip install jupyterTerminal window python3 -m venv venvsource venv/bin/activatepython3 -m pip install --upgrade pippython3 -m pip install jupyter -
Open the notebook in Jupyter Lab.
Run the following commands in your terminal to open Jupyter Lab:
Terminal window jupyter trust *.ipynbjupyter labOpen the notebook file in Jupyter Lab and run the cells. If the data for the example has not already been loaded in your Snowflake account, you’ll need to go to the Appendix and run the data-loading operations before running the main cells.