Using Jupyter Notebooks with Aunsight

Jupyter is an open source tool for coding in an environment that allows users to combine code evaluation with static content like Markdown-formatted text, images, mathematical equations, and other forms of rich content. Jupyter notebooks are plain text files (.ipynb files) containing code and static content that can be managed and opened in a JupyterLab environment. Because of its popularity among data scientists and researchers, Jupyter notebooks are widely used and are well-documented by the Project Jupyter community.

Users can easily create and manage JupyterLab environments for interacting with the Aunsight platform from the Data Lab dashboard. Actually getting work done within that environment is also made easy by features specially built into Aunsight JupyterLabs. The present article discusses these features including the Aunsight Toolbelt in a Linux terminal environment, notebook templates for performing work with the Aunsight SDKs, and how to change kernels for notebooks.

Terminal

Although machine learning projects may interact directly with the Aunsight platform via the SDK interfaces, occasionally it may be desirable to download datasets or update resources outside of a notebook environment. For this reason, Data Lab notebooks provide a terminal environment with an installed version of toolbelt, Aunsight's command-line interface to the platform. This terminal environment offers a full Debian Linux environment with command line tools for working with data. Users can directly interact with the Aunsight platform via this console using Toolbelt. For example, a user could download a dataset to an attached notebook volume, thereby allowing access to that data as a filesystem object from multiple notebooks in the JupyterLab environment.

To access the terminal, go to the JupyterLab launcher by selecting File -> New Launcher in the menu bar at the top of the screen. From the launcher, scroll down to "Other" and click "Terminal."

JupyterLab open terminal on launcher

This will bring up the terminal shell in a tab. As with notebook pages themselves, terminals will continue to run unless shut down. To close an open terminal, click the "Stop" icon (stop icon Jupyterlab) to navigate to the list of running Jupyter sessions. From this list, click "Shut Down" for the terminal(s) you wish to shut down.

Shutting downa  Jupyter Terminal

Templates

Because many data modeling projects use similar approaches to solving a question or problem, Aunsight Jupyter notebooks come with a folder that contains example code for common housekeeping tasks like loading data, managing models, plotting and visualizing data, as well as advanced tasks like churn prediction and image classification. To access these templates built into the notebook, click the "File Browser" icon (files browser icon Jupyterlab). The templates are kept in the folder named example_project. There is also a readme file with further information about the available templates (README.html).

templates directory

A Note on Kernels

Users of Jupyter notebooks may be aware that notebooks can run multiple kernels. However, Aunsight notebook's are run inside prebuilt Docker containers that only contain certain kernels by default. Users should be aware of this constraint and chose a base image that supports all of the features needed. If a user needs to use a non-standard kernel, users may change the capabilities of the notebook by stopping it from the Data Lab dashboard and starting it again with a new Docker base image that supports the desired kernel(s).