![DR Notebooks quote blue bg 1](https://www.datarobot.com/wp-content/uploads/2023/01/DR-Notebooks-quote_blue-bg-1.png)
Most, if not all, machine learning (ML) models in production today were born in notebooks before they were put into production. ML model builders spend a ton of time running multiple experiments in a data science notebook environment before moving the well-tested and robust models from those experiments to a secure, production-grade environment for general consumption.
42% of data scientists are solo practitioners or on teams of five or fewer people. Data science teams of all sizes need a productive, collaborative method for rapid AI experimentation.
The new DataRobot Notebooks offering plays a crucial role in providing a collaborative environment for AI builders to use a code-first approach to accelerate one of the most time-consuming parts of the machine learning lifecycle.
DataRobot Notebooks is a fully hosted and managed notebooks platform with auto-scaling compute capabilities so you can focus more on the data science and less on low-level infrastructure management.
Deep Dive into DataRobot Notebooks
Let’s walk through a step-by-step process with a sample dataset and explore how a data science professional can use DataRobot Notebooks to run an end-to-end experiment by leveraging the DataRobot API and multiple open-source libraries.
We will be writing code in Python, but DataRobot Notebooks also supports R if that’s your preferred language.
Use Case: Predicting Hospital Readmission Probability for a Patient
![Use Case: Predicting Hospital Readmission Probability for a Patient
- DataRobot](https://www.datarobot.com/wp-content/uploads/2023/01/image-1024x426.png)
Augmented Intelligence (AI) in the healthcare industry has been rapidly gaining momentum in recent years. Clinics and hospitals like Phoenix Children’s use AI to predict which patients are at risk of contracting an illness so that they can then prescribe medication and treatment accordingly.
Proactively identifying the likelihood of hospital readmission for a patient goes a long way in ensuring quality care for patients, while decreasing operating costs for hospitals. By predicting which patients are at risk of readmission before they are discharged, doctors can follow appropriate medical procedures to prevent readmission, optimize costs, and enhance the quality of treatment.
In order to make these predictions, we use indicators like patient diagnosis, length of stay, previous medical records and admissions, age, and other demographics within our dataset.
Create DataRobot Notebooks in a Centralized Notebook Management Space
![Create DataRobot Notebooks in a Centralized Notebook Management Space - DataRobot](https://www.datarobot.com/wp-content/uploads/2023/01/xiCkPc6acE8VW_fdt7F1ZjcNgX0IDSOSEWNQDrV8b64ri6mmeZBcieghpDx5Edj5BhC1EYHKhkoVVkTeKZkcZ676QXpnoCltX6Gr2D39TShmV-p30T-_AYsD85_mLixyNjgR4rMwgr5TkVENzs2IwTvWYvLrHcfSuVHxiihStjDTsXd2XdERX0PLvK8e2A-1024x551.png)
Our first step is to create a notebook. With the DataRobot AI platform, you can either upload your own Jupyter Notebook (.ipynb file) by clicking on the “Upload notebook” button, or create a new notebook by clicking on “Create new notebook.”
This flexibility allows you to import your local code into the DataRobot platform and continue further experimentation using the combination of DataRobot Notebooks with:
- Deep integrations with DataRobot comprehensive APIs
- Auto-scale compute
- A host of open-source libraries
By providing a centralized space to store and access all your notebooks, DataRobot Notebooks enables data science teams to move past siloed local development and collaborate together more productively.
For the purposes of this blog, we will be creating a new notebook from scratch on the DataRobot platform.
Configuring the Notebook Environment, Installing Dependencies and Scaling Compute – All in One Click.
![Configuring the Notebook Environment, Installing Dependencies and Scaling Compute - All in One Click](https://www.datarobot.com/wp-content/uploads/2023/01/xlQHx2OMkpD0hjdslflIWNCaMHfTlmdhiJclIX8xSWZqgzo664nXKgFIWWCo1wupw3AYuIycsF3v-6F7UsLQrWwMRrrYy6Gw-hAoB6aKU2FIU04Sok9gVlg_azAr53a1T6IoE_GJc1k1MPC4BZF19Je0-csRDJr_d5zIpi29nXGzH3YteFIug8k7SBMj0A-1024x621.png)
Next, set up the required resource configurations to run AI experiments in the DataRobot Notebook.
Many data scientists aren’t big fans of spending time on the nitty gritty details of setting up infrastructure or low-level configurations. Although this work is necessary to ensure a performant, enterprise-grade development environment, it is a tedious and time-consuming process that data scientists may not have the relevant expertise to complete.
DataRobot Notebooks handles infrastructure configurations with ease by enabling users to spin up a containerized environment for running and executing their notebooks in just a few seconds with a single click. The infrastructure and setup for managing the underlying resources are abstracted from the user and fully managed by DataRobot.
As shown in the images below, these built-in environments come pre-installed with commonly used machine learning libraries, saving time that your data science team would otherwise spend on installation and troubleshooting complex dependencies.
![DataRobot Notebooks pre-installed with commonly used machine learning libraries](https://www.datarobot.com/wp-content/uploads/2023/01/5TOK9fvvfAwLKoL-uKxGYAzpEs4xKKbqaOddLOucnCVVyWHIyNc_MCQ3vCXSvGss2WYt63pNdktNXp3Q__c4eBaqNSrHQcp5rngFM_GkKHxTROAt62NeJHlfAl6U47UzjjThgxHI6arzSlxbEqTZOsTbhL616GjnknrRr3geaD9oa7ajfwx07hjVaM-4-Q.png)
![DataRobot Notebooks pre-installed with commonly used machine learning libraries](https://www.datarobot.com/wp-content/uploads/2023/01/3RWhNsv9EVfDjBY8ys6s-fCQwYHkicy5kILHgpdeBO1u4oHW97hFrGZZJQs_QdG3anu8zF9ZdLLU1Y9Lx6puudPCUCxOTlY0dUOZxgpJJPnFU1Sjc4iUhJK5GoOz8qiGwIzKjg0sPyS52MkwKSNeT8HeChzSHExI6ABLyeNL28JarKG2Vy8JkFxsIcUHCQ.png)
Capabilities Beyond Classic Jupyter for End-to-end Experimentation
![DataRobot Notebooks Capabilities Beyond Classic Jupyter for End-to-end Experimentation](https://www.datarobot.com/wp-content/uploads/2023/01/2fFiyQ_pykULIAd6TEfp7_2YeOPKaJRpejAD35DW-mx4P1imsyz8tB9omt_bPG7HeNvr1HgQ998_6Mj9UQBAnn41Xfb7hwe3oXEH6sNqMY9zwEMFsIg0pooA1ltDhsvyRcRihY6JYN0rJvbA31gI6PjsihwmBxd5SSgoIOaIx0JLlDSF53jzcJCdF-6FIw-1024x552.png)
Now that we have set up the notebook environment, let’s explore the capabilities available in DataRobot Notebooks while walking through the process of training and deploying a readmissions prediction model end-to-end.
DataRobot Notebooks are fully compatible with the Jupyter Notebook standard, allowing for interoperability with the rest of the ecosystem. The platform has parity with the core Jupyter capabilities, so users are able to onboard without a steep learning curve. And with enhancements and native integrations beyond the classic Jupyter offerings, DataRobot Notebooks provides a robust and streamlined experience across the ML lifecycle, from data exploration and model development to machine learning operations (MLOps).
Notebook Environment Variables for Secure Secrets Management
![Notebook Environment Variables for Secure Secrets Management](https://www.datarobot.com/wp-content/uploads/2023/01/LNXHZustf84sPsAV_vNiSQfU9ZjDZRc6xvhmsoLD7LCxx4lOinFR6KJwbAKrhtHFx9Bo0WKu-k9hlcbmqE3wk2erwCOS3AEQiPiOZITteUVD5HEWlqxCcyLR429RY5onj7bO8ChM8FwEXx4hmEUb8f9B5alp1xJOWMyLF450ebXj5Tu5-PvgtgM6Aa8qIQ-1024x414.png)
If you have sensitive information you need to reference in your notebooks, such as credentials for connecting to external data sources, you can securely store these secrets via notebook environment variables. These environment variables are stored as encrypted files, and DataRobot handles setting the variables in your environment at the start of each notebook session.
Built-in, Intuitive Cell Functions Promote Better Usability for Exploratory Analysis
![Built-in, Intuitive Cell Functions Promote Better Usability for Exploratory Analysis - DataRobot Notebooks](https://www.datarobot.com/wp-content/uploads/2023/01/l7d3r6YaAmq1teILIxVo0GJVhMb-Y18cmEZs-sA0ko7fn1TG1hLO_ZvaKjZZ8Pmq312L48vyYVzmMVOdI-qMy6jbbvYAfGqE7VNlLBRC3QxqpXH3cmt9QaMZVXSzuNJwQerFylOo85RE-cTY5l7e7iC7mtFWzKsSYHauaHgM9LnHiEZggy3ReAroA977-A-1024x551.png)
For this experiment, we are going to ingest the hospital readmissions data from a CSV file downloaded to the notebook’s working directory using a shell command. Once converted into a Pandas dataframe, we can perform any exploratory analysis we would like using the Pandas library.
Did you notice?
In the DataRobot left sidebar, there is a table of contents auto-generated from the hierarchy of Markdown cells. With this feature you can more easily navigate the notebook, in addition to presenting your work to teammates and stakeholders. This is similar to the table of contents auto-generated by Google Docs.
Seamless DataRobot API Integration for Hassle-free Workflows
![Seamless DataRobot API Integration for Hassle-free Workflows](https://www.datarobot.com/wp-content/uploads/2023/01/k-bWj58Hj-yjlCWO57RlaWLdLasuKH8aiGSdtM4IAxlZwaaIHxV50gHE4iwS96zeMx2HQsR3m640nxlqdW1c6jcAm4BhoGPiHGl1cjE5w5ipkg2CDUuE5T8aEYJEteKOrBbYl4T5ZxxR2pSSvfa73ag8uJP5NnqL5O_FJTAVLgZR4isEd3NnwLzw_0TC-Q-1024x551.png)
The built-in notebook environments come with the respective DataRobot client (Python or R) preinstalled, and DataRobot handles authenticating the client on the user’s behalf. This means you can skip the extra steps otherwise needed for fetching and configuring the API token to access DataRobot functions. For any packages not in the default images, DataRobot Notebooks provides the flexibility to install those packages during your session. Run the magic command !pip install <your-package> within a code cell. You can also run other shell commands within notebook cells by using the ! notation.
In the image above, we have imported the DataRobot Python client and kickstarted model training using Autopilot, the DataRobot automated machine learning capability. The progress of these modeling tasks can be monitored not just in your notebook, but also within the DataRobot GUI.
Did you notice?
DataRobot has built-in revision history for notebooks, accessible from the sidebar. You can take manual revisions (aka “checkpoints”) of your notebook to version and track the changes to the notebook during development. Automatic revisions are also taken at the end of each notebook session. Each revision of a notebook saves the notebook cells as well as any outputs that were in the notebook at the time of checkpointing. You can preview all of a notebook’s revisions and restore your notebook to a previous version at any point.
Built-in Code Snippets and Interactive Visualizations to Accelerate Experimentation
![Built-in Code Snippets and Interactive Visualizations to Accelerate Experimentation - DataRobot Notebooks](https://www.datarobot.com/wp-content/uploads/2023/01/fpOfJIvv8lFatNa2oCuGRpeK_gF18lR2rL0neU0tAEvsQYOUIGCRVU8_ZykDA6CwBg8XTPzfdSMJpIeRI9t4ZFPlIalxRzqzM-18S0ZkjjIFazRKba5FmkEGfGXf9ZrPaw-gaSeyu8oyTiZJrc5OWdkC8QNpgWONl4oEscJZrbP3sOZ0IPk7I35i7RMu-Q-1024x552.png)
Now that we have explored the dataset and obtained a leaderboard of trained models to choose from, our natural next step is to evaluate these models for accuracy and performance. Since this is a binary classification problem, we can use ROC curves to benchmark the models and then choose the best one.
Code snippets, as seen in the image above, are available for a variety of common data science tasks including connecting to external data sources, deploying models, and generating custom metrics, as well as creating ROC curves. The image below shows the ROC curve plotted for us by the code snippet above and other code snippets available in the sidebar.
In addition, code intelligence capabilities, including autocomplete and inline documentation for each function, are accessible via simple keyboard shortcuts.
These DataRobot features are huge time savers. Instead of spending time looking up boilerplate code or recalling function parameters, you can laser focus on experimentation and expedite code development.
![The DataRobot Notebooks time saving features](https://www.datarobot.com/wp-content/uploads/2023/01/cnLXZb8zfU7rjY4UYtfNW72bIGFI2EkofTvgso5ehioMOdiPgwixeQuGKd7I9sprLuuzxx3q9p_-CL1_sj0W2QRov7sZ3ThpMn6LfLm94WHc-3P5r-Y8p5Y8URFSWEF-X9E8kekEmx6x-1k0IZ3zWuaNy054WG9LISpivcf2dVd75jw55oPiKarLktiQ-1024x552.png)
Model Explainability for Responsible and Trusted AI
![Model Explainability for Responsible and Trusted AI - DataRobot](https://www.datarobot.com/wp-content/uploads/2023/01/image14-1024x550.png)
There are no black boxes in DataRobot, meaning that there is an explanation for every prediction, as well as every model. The image above shows a visualization for some of the most important features of the top-performing model on the leaderboard for our hospital readmission dataset. Here we have generated this plot using the Seaborn library, but you can visualize data using any package of your choice.
Did you notice?
In the sidebar, DataRobot Notebooks displays a list of keyboard shortcuts for commonly used cell- and notebook-level actions. The keyboard shortcuts used in DataRobot Notebooks are the same as those in Jupyter, providing users with a familiar user interface and reducing the friction of onboarding to the platform. You can easily reference these keyboard shortcuts while developing and executing your notebook code.
Simulate Real-world Scenarios with Seamless Model Deployment
![Simulate Real-world Scenarios with Seamless Model Deployment - DataRobot](https://www.datarobot.com/wp-content/uploads/2023/01/6Dd5wZUhl0bT_SMsLgLdKK8VpH2Mt0nJZKvu_VODcwvGu8tdh0NN3rVn0yL4hetImR5LeenqLM4qV6E-8d-rmSHc1vwmShJy_EFddQIbtff5G7FWI_4Acp4eZUE5roi54QPcMYhVbH22lKc0CfQbS3XV-QXSXAjV-rLOfwcFhtOGJ2gNjFjN0j_JotT-7A-1024x552.png)
Almost 90% of machine learning models never make it into production. Deploying and operationalizing a machine learning model is a large task for a variety of reasons: differences in coding languages between data scientists and ML engineers, difficulty in setting up the underlying infrastructure for servicing prediction servers, and so on.
Although challenging, model deployment in production is the most crucial stage of the ML lifecycle, ensuring that a data science team’s efforts are driving direct value to the business. Within DataRobot Notebooks, you can deploy a model in just a few lines of code using the DataRobot API. There is also a code snippet you can leverage to save time.
Learn More About DataRobot Notebooks
DataRobot Notebooks address the challenges around collaboration, scalability and security of open-source notebooks, while still providing data science professionals the freedom to work in an environment they’re familiar with. Creative experimentation is possible only when a data scientist devotes more time to research and development and less time to infrastructure and administrative tasks.
With DataRobot Notebooks, high maturity data scientists can elevate their code-first workflows by leveraging DataRobot power tools as well as the ecosystem and open-source community.
About the author
![Jaydeep Rane](https://www.datarobot.com/wp-content/uploads/2022/10/Jaydeep-Rane-e1664802332318-300x300.jpeg)
Data Scientist, DataRobot
Jaydeep Rane is a data scientist with extensive experience helping Fortune 500 companies leverage AI and significantly accelerate time from ideation to implementation. He has engaged with customers across a diverse set of domains like supply chain, retail, finance and software providers. Jaydeep enabled them to solve challenges covering demand forecasting, customer churn prediction, natural language processing, revenue forecasting (and more) using machine learning. He is currently a Product Marketing Manager at DataRobot, connecting data scientists globally with DataRobot’s core offerings that significantly amplify productivity for their teams.