Perform classification with a boosted trees modelStay organized with collectionsSave and categorize content based on your preferences.
This tutorial teaches you how to use aboosted trees classifier modelto predict the income range of individuals based on their demographic data.
The model predicts whether a value falls into one of two categories, in this
case whether an individual's annual income falls above or below $50,000.
Sign in to your Google Cloud account. If you're new to
Google Cloud,create an accountto 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.
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.
BigQuery is automatically enabled in new projects.
To activate BigQuery in a pre-existing project, go to
Enable the BigQuery API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM
role (roles/serviceusage.serviceUsageAdmin), which
contains theserviceusage.services.enablepermission.Learn how to grant
roles.
The model you create in this tutorial predicts the income bracket for census
respondents, based on the following features:
Age
Type of work performed
Marital status
Level of education
Occupation
Hours worked per week
Theeducationcolumn isn't included in the training data, because
theeducationandeducation_numcolumns both express the respondent's level
of education in different formats.
You separate the data into training, evaluation, and prediction sets by creating
a newdataframecolumn that is derived from thefunctional_weightcolumn.
Eighty percent of the data is used for training the model, and the remaining
twenty percent of the data is used for evaluation and prediction.
Create a boosted trees model to predict census respondents' income bracket, and
train it on the census data. The query takes about 30 minutes to complete.
Thepredicted_income_bracketcontains the predicted value from the model.
Thepredicted_income_bracket_probs.labelshows the two labels that the
model had to choose between, and thepredicted_income_bracket_probs.probcolumn shows the probability of the given label being the
correct one.
To avoid incurring charges to your Google Cloud account for the resources used in this
tutorial, either delete the project that contains the resources, or keep the project and
delete the individual resources.
You can delete the project you created.
Or you can keep the project and delete the dataset.
Delete your dataset
Deleting your project removes all datasets and all tables in the project. If you
prefer to reuse the project, you can delete the dataset you created in this
tutorial:
If necessary, open the BigQuery page in the
Google Cloud console.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-05-08 UTC."],[],[]]