Use the Data Science Agent
This guide describes how you can use the Data Science Agent in Colab Enterprise to help you perform data science tasks in your notebooks.
Learn how and when Gemini for Google Cloud uses your data.
This document is intended for data analysts, data scientists, and data developers who work with Colab Enterprise. It assumes you have knowledge of how to write code in a notebook environment.
Capabilities of the Data Science Agent
The Data Science Agent can help you with tasks ranging from exploratory data analysis to generating machine learning predictions and forecasts. You can use the Data Science Agent for:
- Large-scale data processing: Use BigQuery ML, BigQuery DataFrames, or Managed Service for Apache Spark to perform distributed data processing on large datasets. This lets you efficiently clean, transform, and analyze data that's too large to fit into memory on a single machine.
- Generating plans: Generate and modify a plan to complete a particular task using common tools such as Python, SQL, Apache Spark, and BigQuery DataFrames.
- Data exploration: Explore a dataset to understand its structure, identify potential issues like missing values and outliers, and examine the distribution of key variables.
- Data cleaning: Clean your data. For example, remove data points that are outliers.
- Data wrangling: Convert categorical features into numerical representations using techniques like one-hot encoding or label encoding. Create new features for analysis.
- Data analysis: Analyze the relationships between different variables. Calculate correlations between numerical features and explore distributions of categorical features. Look for patterns and trends in the data.
- Data visualization: Create visualizations such as histograms, box plots, scatter plots, and bar charts that represent the distributions of individual variables and the relationships between them.
- Feature engineering: Engineer new features from a cleaned dataset.
- Data splitting: Split an engineered dataset into training, validation, and testing datasets.
- Model training: Train a model by using the training data in a pandas
DataFrame, a
BigQuery DataFrames,
a PySpark DataFrame,
or by using the BigQuery ML
CREATE MODELstatement with BigQuery tables. - Model optimization: Optimize a model by using the validation set.
Explore alternative models like
DecisionTreeRegressorandRandomForestRegressorand compare their performance. - Model evaluation: Evaluate model performance on a test dataset using a pandas DataFrame, BigQuery DataFrames, or a PySpark DataFrame. You can also assess model quality and compare models by using BigQuery ML model evaluation functions for models trained using BigQuery ML.
- Model inference: Perform inference with BigQuery ML trained
models, imported models, and remote models using BigQuery ML
inference functions. You can also use
the BigQuery DataFrames
model.predict()method or PySpark transformers to make predictions.
Limitations
- The Data Science Agent supports the following data sources:
- CSV files
- BigQuery tables
- The code produced by the Data Science Agent only runs in your notebook's runtime.
- Your notebook must be in a region supported by the Data Science Agent. See Locations.
- The first time you run the Data Science Agent, you may experience some latency of approximately five to ten minutes. This only occurs once per project during initial setup.
- Searching for BigQuery tables using the
@mentionfunction is limited to your current project. Use the table selector to search across projects. - The
@mentionfunction only searches for BigQuery tables. To search for data files that you can upload, use the+symbol. - PySpark in the Data Science Agent only generates Apache Spark 4.0 code. The Data Science Agent can help you upgrade to Apache Spark 4.0, but users who require earlier versions of Apache Spark shouldn't use the Data Science Agent.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Agent Platform, Dataform, and Compute Engine APIs.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Agent Platform, Dataform, and Compute Engine APIs.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.