Supercharge Your Workflows with AI-First Colab

By Google for Developers

Share:

Key Concepts

  • Colab (Google Colaboratory): A cloud-based Jupyter notebook environment hosted by Google, offering zero setup, free access to powerful computing resources (GPUs, TPUs), and collaborative features via Google Drive.
  • AI-first Colab: An enhanced version of Colab featuring an "agentic collaborator" powered by Google's Gemini AI model, designed to accelerate data science, machine learning, and AI workflows through natural language interaction.
  • Gemini: The underlying AI model that enables natural language processing and code generation within AI-first Colab, acting as an intelligent coding partner.
  • Jupyter Notebook: An open-source web application that allows you to create and share documents containing live code, equations, visualizations, and narrative text.
  • Data Science Workflow: A systematic process encompassing data acquisition, cleaning, analysis, visualization, and interpretation to extract insights.
  • Natural Language Interaction: The ability to communicate with the AI companion using everyday human language, rather than requiring specific programming syntax.
  • Agentic Collaborator: An AI system that acts autonomously to achieve user goals, understanding context, generating code, executing tasks, and even self-correcting errors.
  • Data Frames: Tabular data structures, commonly used in Python with the Pandas library, for storing and manipulating data.
  • Altair: A declarative statistical visualization library for Python, used for creating interactive plots.

Introduction to AI-First Colab

Aloc, a developer advocate at Google Cloud, introduces AI-first Colab as a tool to "supercharge your productivity" and serve as "a true coding partner in your notebook." This platform aims to "unlock data science, machine learning, and AI workflows with unprecedented scale and ease." Colab is described as a "Jupyter notebook in the cloud, hosted by Google," requiring "zero setup" and providing "strong computing resources like GPUs and TPUs for free." Notebooks run in the browser, support collaboration via Google Drive, and are particularly suited for data analysis, machine learning, and generative AI, being popular in education and research.

The core innovation is its "AI-first" design, featuring an "agentic collaborator" powered by Gemini. This allows users to perform their "entire data science workflow through natural language." The AI companion understands the user's code, the state of their data, and their objectives, facilitating an "iterative and collaborative experience" where users can issue short commands, follow-ups, and even change their minds mid-conversation, truly "working with the agent." This interaction significantly "lowers barriers for anyone looking for insights from their data."


Demonstration: Ice Cream Data Analysis Workflow

The demonstration uses an ice cream products dataset from Kaggle, containing information on 241 ice cream flavors across four brands and over 21,000 total reviews. The data was pre-downloaded into Google Drive.

1. Setting Up the Notebook and Initial Interaction

  • Creating a New Notebook: The process begins by navigating to collab.google.com and selecting "new notebook."
  • Initiating AI Interaction: An empty Colab notebook opens, displaying a toolbar at the bottom with the prompt "what can I help you build." This is where interaction with Gemini begins.
  • First Prompt: The user's initial prompt is: "can you analyze the ice cream products and reviews data from the ice cream data folder in my Google Drive?"
  • Gemini's Plan Generation: Gemini processes the request and generates a multi-step plan:
    1. Mount Google Drive.
    2. Load data.
    3. Analyze the data.
    4. Visualize findings.

2. Data Loading and Initial Analysis

  • Executing the Plan Step-by-Step: The user clicks "run step by step" to execute Gemini's plan.
  • Mounting Google Drive: Gemini first generates code to mount Google Drive. After user authorization through a series of screens, Colab gains access to the user's Drive, allowing direct access to the ice cream data folder without manual uploads.
  • Loading Data Frames: Gemini then writes code to load two CSV files (products.csv and reviews.csv) from the specified folder into two Pandas data frames.
    • The products data frame includes product info like name, description, rating, and ingredients.
    • The reviews data frame contains one row per review, including author, title, helpfulness votes, and the actual review text for over 21,000 reviews.
  • Directed Analysis: Instead of following Gemini's suggested next steps, the user provides specific direction: "filter to reviews that were a net positive and helpfulness and then calculate total number of ratings and average star ratings by product from those helpful reviews." The goal is to include only ratings from reviews deemed helpful by others. Gemini generates the Python code, which the user reviews and runs, successfully outputting the number of helpful ratings and average stars per product. This highlights Gemini's ability to perform common data manipulation tasks without requiring the user to recall exact Python syntax.

3. Refining Data Analysis

  • Advanced Filtering and Sorting: To refine the results, the user prompts Gemini to: "limit down the products with at least 25 ratings, sort by average star ratings, and then total number of ratings, and add in brands, product names, and descriptions from the product data."
  • Data Merging: Gemini successfully generates code that properly merges the products data with the calculated average star ratings. The results display ice creams with "perfect 5.0 average ratings," complete with their brands, names, and descriptions.

4. Visualization and Export

  • Interactive Scatter Plot: The user requests an "interactive scatter plot of the average ratings versus the number of ratings for the products in my last data frame." Gemini generates the code using the Altair plotting library. The resulting plot allows users to hover over each point to identify the product it represents.
  • Saving the Plot: To share the interactive plot, the user asks Gemini to "save off the scatter plot as an HTML file." Gemini modifies the code cell to include the saving functionality, and upon rerun, the plot is saved in the files pane, ready for download and sharing.

5. Displaying Images and Error Handling

  • Displaying Top-Rated Product Images: The final step involves displaying images for the top-rated ice creams. The user provides instructions on what to display and where the image files are located.
  • Multi-Step Plan and Auto-Run: Gemini responds with a five-step plan:
    1. Identify top five products (those with 5.0 average ratings).
    2. Construct image file paths using product keys.
    3. Verify image files (Gemini finds images for "four out of the five" top products).
    4. Display product information.
    5. Handle potential errors. The user accepts and auto-runs the plan, demonstrating confidence in the AI companion.
  • Self-Correction: During execution, Gemini encounters an error while attempting to display product information. Crucially, "the agent keeps working and actually fixes its own error before we can even see what happened." The images are then successfully displayed along with names, ratings, and descriptions for each product, as requested.

Conclusion and Future Potential

The demonstration concludes by highlighting the rapid progression from an "empty collab to a full-fledged analysis, interactive visualization, and images of ice cream products" in just a few minutes, "without having to write a single line of code ourselves." This showcases the immense productivity gains offered by AI-first Colab.

Aloc emphasizes that this is "just the beginning" and future demos will explore how the companion can "supercharge other workflows like end-to-end machine learning and using generative AI APIs." Users are encouraged to get started by opening any new or existing Colab notebook, looking for the Gemini Spark icon in the bottom toolbar, and interacting with their AI coding partner using natural language. The speaker expresses anticipation for how AI-first Colab will transform data science and machine learning journeys.

Chat with this Video

AI-Powered

Load the transcript when you're ready to chat so the initial page stays lighter.

Ready to summarize another video?

Summarize YouTube Video