How to Interact with Squirro Using Jupyter Notebook#
Profiles: Data Scientist, Project Creator
This guide shows you how to interact with Squirro using Jupyter Notebook.
Specifically, it guides you through the process of installing the necessary software components and provides a sample Notebook to get you started.
Note
It is assumed that you have already installed a recent version of Python. If you have not, refer to the official Python documentation.
Prepare a Virtual Environment#
With Python installed, open a console and create a virtual environment:
python -m venv ~/squirro-venv
This virtual environment will be used to install any Python packages that you may need during your experiments with Squirro.
Reminder: Remember that you need to have this virtual environment activated to install new packages in it or use existing ones. You can always activate it by issuing the following command:
source ~/squirro-venv/bin/activate
For more information regarding virtual environments in Python, refer to the official Python guide, though the information on this page will likely be sufficient.
The next step is to install two packages in your virtual environment:
Jupyter Notebook
SquirroClient
pip install SquirroClient notebook
The SquirroClient
is the official Squirro SDK for Python. You can use it to programmatically interact with your Squirro instance.
Reference: For more information, see SquirroClient (Python SDK).
The Jupyter Notebook is an application that is widely used when conducting an Exploratory Data Analysis (EDA).
If you prefer an alternative software package (such as JupyterLab) feel free to use it as well. The only restriction for it is that you need to be able to run Python code.
Launch the Jupyter Notebook server#
Now, you are ready to launch the Jupyter Notebook server:
jupyter notebook
You can either create a new notebook or use the one provided here to get you started.
Obtain a Personal Access Token#
The last step that you need to do is to obtain a personal access token for interacting with Squirro and use it for authenticating the SquirroClient
. To get one, navigate to your Squirro instance. Then, in the top-right corner, click on your initials and select My Account.
In the left menu, click API Access, then click Generate within the User Token field.
Copy your token and set it as a value to the token
variable of the
provided Jupyter notebook.
Get to Work With Your Data#
The provided Jupyter notebook shows you how to connect to a Squirro instance, and includes a basic demo of how to use the SquirroClient (Python SDK) along with some toy ground truth data to get you started with an EDA.
Firstly, you need to create a Ground Truth using AI Studio.
Reference: See ai-studio-ground-truth for more information.
Then, by using the method get_groundtruth_labels
of the SquirroClient
and providing the id of the ground truth (groundtruth_id) and the id of the project that this ground truth belongs to (project_id), you can fetch all its labeled examples.
The complete demo can be found in the provided Jupyter notebook.