Build an NYC Taxi Fare Predictor
Train a no-code NYC taxi fare model with Amazon SageMaker Canvas.
Introduction
30 Second Summary
A taxi fare can feel unpredictable before the ride starts. Historical journeys can reveal which trip details actually move the price.
In this project, you will build a browser-based NYC taxi fare predictor in Amazon SageMaker Canvas. The workflow takes you from a cloud-hosted taxi dataset to a trained model with visible evaluation results.
What You'll Build
Your finished Canvas model turns real trip details into a numeric fare estimate directly in your browser.
By the end of this project, you'll have:
- A live data preview of official NYC taxi rows loaded directly from Amazon S3.
- A Data Quality and Insights report showing that year plus hour_of_day have low predictive power for Fare amount.
- A numeric fare model with a Ready status. Its evaluation metrics are available for your project walkthrough.
- Secret Mission: Run two what-if predictions using different Trip distance values. You will export the result as a CSV file.
Are there any prerequisites?
You need an AWS account with permission to create an Amazon SageMaker AI domain plus its execution role. You also need a desktop browser with JavaScript enabled.
Before We Start
This first checkpoint locks in your goal before you create any AWS resources. You are preparing to build a regression model that predicts NYC taxi fare amounts through a browser-based workflow in Amazon SageMaker Canvas.
Set Up SageMaker Canvas
Your taxi fare model needs a managed workspace before it can safely process cloud data. An Amazon SageMaker AI domain gives the workspace a central boundary.
Amazon SageMaker Canvas runs inside the domain through a user profile. You will finish with the Canvas home page open in your chosen AWS Region.
In this step, get ready to:
- Choose one AWS Region for every project resource.
- Create or reuse a suitable SageMaker AI domain with a Canvas user profile.
- Launch Canvas from the selected user profile.
Choose one AWS Region
AWS resources live in specific Regions. Keeping this project in one Region prevents its workspace from becoming separated from its later model resources.
Signing in can feel security-sensitive. Your credentials belong only on the AWS sign-in page.
- Go to the AWS Management Console sign-in page in your desktop browser.
- Sign in with your AWS account.
- Select one AWS Region from the console header.
- Record the selected AWS Region here: your selected AWS Region.
The console now uses your selected Region. Every resource in this project stays within that boundary.
Create or reuse a SageMaker AI domain
A SageMaker AI domain supplies the storage boundary for Canvas. A user profile gives your Canvas session an identity within that domain.
- Open Amazon SageMaker AI from the AWS Management Console.
- Choose SageMaker Canvas.
- Check whether the page shows a suitable domain with a Canvas user profile.
✔️ A suitable domain already exists
A suitable domain must be in your selected Region. It must also contain a user profile that can launch Canvas.
- Confirm that the domain is in your selected AWS Region.
- Confirm that the domain contains a user profile with permission to launch Canvas.
- Select that user profile.
ⓧ I need a new domain
Domain setup can take a few minutes. That pause is AWS creating the managed workspace boundary.
- Choose Create a SageMaker AI domain.
- Choose Set up.
- Wait for the domain setup to finish.
- Confirm that the new domain contains a user profile.
Your selected Region now contains a domain with a user profile that can run Canvas.
Can't create or use a domain?
Your AWS account may lack permission to create the domain or use its profile. An account administrator can grant the required SageMaker access.
- Confirm that the console still shows your selected AWS Region.
- Ask your AWS account administrator to confirm your SageMaker domain permissions.
Help me troubleshoot access to my SageMaker AI domain.
Launch the Canvas application
Launching Canvas starts a managed workspace for your user profile. The browser then becomes your machine learning workbench.
Canvas starts workspace billing
Launching Amazon SageMaker Canvas starts workspace billing. Outside eligible free-tier usage, the workspace costs $1.90 per session-hour.
Workspace billing ends when you log out. Training and prediction have separate charges.
- Return to SageMaker Canvas in your selected AWS Region.
- Select the domain that you created or confirmed.
- Select the user profile that can launch Canvas.
The first launch can take a few minutes while AWS starts the workspace.
Before you launch Canvas, what page do you expect to see when the setup is connected correctly?
- Launch Canvas with the selected user profile.
- Wait for Canvas to finish loading in your desktop browser.
You should see the Canvas home page in your browser. That is the workspace live and ready for your taxi data.
Canvas home page not loading?
- Confirm that the AWS console still uses your selected AWS Region.
- Confirm that the selected user profile has permission to launch Canvas.
- Retry the launch from that user profile.
Help me troubleshoot why the Canvas home page is not loading.
Your managed Canvas workspace is ready. Next, you will bring the NYC taxi data into Canvas for its first visible preview.
Import and Preview the Taxi Data
Your Amazon SageMaker Canvas workspace is ready. The fare predictor still needs trip records to learn from.
This step brings the official NYC taxi dataset into SageMaker Data Wrangler from Amazon S3. A visible preview confirms the column structure before you make assumptions about the model.
In this step, get ready to:
- Open the Data Wrangler tabular importer.
- Create a saved Data Wrangler flow from the official taxi dataset.
- Confirm the model columns in Preview data.
Choose the tabular import path
A Data Wrangler flow gives your dataset a visual path through preparation and analysis. The tabular importer starts that path with rows arranged into columns.
- On the Canvas home page from earlier, choose Data Wrangler.
- Choose Import data.
- Choose Tabular.
You'll see the available tabular data sources. This confirms that Canvas is ready to connect to the taxi dataset.
Connect the Amazon S3 dataset
An S3 endpoint identifies the exact cloud object that Canvas should import. This source is a CSV file containing the official NYC taxi records.
- Select Amazon S3 as the data source.
- Enter s3://amazon-sagemaker-data-wrangler-documentation-artifacts/canvas-single-file-nyc-taxi-dataset.csv in the Input S3 endpoint field.
- Confirm the dataset list shows the NYC taxi file from that location.
The dataset entry confirms that Canvas can reach the Amazon S3 object.
Preview and save the taxi data
The preview is your first proof that the project has usable data. It also reveals the columns available for later analysis.
- Select the dataset row for the NYC taxi file.
Before you open the preview, which trip details do you expect to see beside the fare value?
- Choose Preview data.
You'll see populated rows with columns including Fare amount, year, and hour_of_day.
- Choose Save to create the Data Wrangler flow.
- Confirm Preview data remains open with the imported rows visible.
What does the preview prove?
The populated rows prove that Canvas can read the official dataset from Amazon S3. Your saved flow now has real trip data to analyse.
The Fare amount column is the future prediction target. The year and hour_of_day columns are part of the raw feature set that you will assess next.
Preview not loading?
- Compare the S3 address with the full value above.
- Wait for the dataset entry to load before selecting it.
If the rows still do not appear, help me troubleshoot this SageMaker Canvas data preview.
You have your first visible win: real NYC taxi rows are loaded into a saved data flow. Next, you'll use a quality report to discover which features help predict fares.
Analyze Feature Quality
Your imported taxi data is now visible in Amazon SageMaker Canvas. The next goal is to test whether its columns can support a useful fare model.
A Data Quality and Insights report measures feature predictive power against a target. The raw table can look model-ready while weak columns hide why the model performs as it does.
In this step, get ready to:
- Generate a Data Quality and Insights report from the default sample.
- Configure a regression analysis for Fare amount.
- Inspect the report's data-quality findings.
Open the report setup
The report starts from the existing SageMaker Data Wrangler flow. It analyzes the same imported data that you previewed earlier.
- Close the current data preview to return to your saved Data Wrangler flow.
- Locate the Data types node in the flow.
- Choose Get data insights next to the Data types node.
You'll see a setup control for Problem type. You'll also see Target column.
Generate the regression report
A regression analysis evaluates features against a numeric target. Here, the target is the fare paid for each trip.
- Keep the default data sample selected.
- Select Regression in Problem type.
- Select Fare amount in Target column.
Before you generate the report, which columns do you expect to have the weakest relationship with taxi fares?
- Generate the report by choosing Create.
A short wait here is normal while Canvas calculates the report.
- Keep the Canvas browser tab open until the completed report appears.
That analysis is complete. Your report is ready for a feature-by-feature check.
Report not appearing?
- Confirm that Canvas remains open in your selected AWS Region.
- Check that the default data sample is still selected.
- Return to Get data insights if report generation stopped.
Help me diagnose why my Data Quality and Insights report is not appearing.
Inspect the quality signals
The report separates model relevance from general data health. Reading both views helps you spot problems before training.
How to read the report
- Feature predictive power estimates how strongly each input can help predict the target.
- Completeness shows how much usable data each feature contains.
- Missing values identify gaps within the dataset.
- Outliers flag values that sit far outside a feature's typical range.
Before you inspect the rankings, which imported fields do you predict will contribute the least to the fare estimate?
- Review the feature predictive power results for every column.
- Compare year against the other features.
- Compare hour_of_day against the other features.
- Review the completeness findings in the report.
- Inspect the missing-value findings.
- Inspect the outlier findings.
You should see low predictive power for year relative to Fare amount. You should see the same finding for hour_of_day.
You found the hidden weakness in the raw table. This is the intended shortfall before training.
Your quality report now explains which features hold the raw dataset back. Next, you'll remove those weak columns before training the fare model.
Train the Fare Model
Your data-quality report exposed two weak features in the raw taxi table. Those inputs would consume limited training time without helping the fare prediction much.
Removing those features lets Quick build focus on more useful trip signals. You will turn the cleaned sample into a numeric fare model inside Amazon SageMaker Canvas.
In this step, get ready to:
- Drop the two weak features from the training data.
- Create a model from the transformed interactive sample.
- Confirm a Quick build model is Ready with visible evaluation metrics.
Remove the weak features
Feature selection keeps the training inputs focused on columns that can help the prediction. Your report gives you evidence to remove year plus hour_of_day.
- Switch back to the saved Data Wrangler flow from the report.
- Choose Add step next to the Data types node.
- Search for Drop column in the transform list.
- Choose Manage columns.
- Choose Drop column.
- Select year.
- Select hour_of_day.
- Choose Preview.
You will see the transformed table without year or hour_of_day.
Why drop the weak columns?
Low predictive power means these columns add little useful signal for predicting Fare amount.
Dropping them gives the build a cleaner set of inputs. The model can spend its search time on trip features with stronger predictive value.
- Choose Add to save the transform.
That first fix is now landed: your Data Wrangler flow includes a Manage columns transform with both weak features removed.
Transform still shows the columns?
- Return to Manage columns if either column remains visible.
- Confirm that year is selected.
- Confirm that hour_of_day is selected.
Help me fix my Manage columns transform when the dropped columns still appear.
Create the sample model
The interactive sample keeps this training run within the project timebox. Turning off Process entire dataset makes Canvas build from the transformed sample.
- Choose Create model from the transformed node.
- Enter nyc-taxi-sample as the dataset name.
The dataset name field now shows nyc-taxi-sample.
- Turn off Process entire dataset.
The export now targets the transformed interactive sample from your Data Wrangler flow.
- Enter nyc-taxi-fare-model as the model name.
- Select numeric prediction as the problem type.
Canvas now treats the project as a regression task that predicts a numeric value.
- Select Fare amount in the Target column field.
- Choose Export and create model.
Good progress. Canvas now has the nyc-taxi-sample dataset plus the configuration for nyc-taxi-fare-model.
Model setup looks wrong?
- Return to model creation if the dataset field does not show nyc-taxi-sample.
- Turn off Process entire dataset before exporting again.
- Confirm that Fare amount appears in the Target column field.
Help me correct my SageMaker Canvas model configuration before training.
Run Quick build and inspect the model
Quick build uses AutoML to search for a numeric prediction model within a shorter training window. This approach fits the project timebox.
Training can add charges
Starting Quick build uses separate training compute. Charges can apply based on your account.
AWS documents a 2 to 20 minute build window for numeric prediction Quick builds. A quiet browser tab during that period does not mean the build has stalled.
- Review the detected model configuration.
- Confirm that nyc-taxi-sample is the selected dataset.
- Confirm that Fare amount is the selected target.
- Choose Quick build to begin training.
Canvas starts training the model with the cleaned interactive sample.
- Wait for the model build to finish.
Before you check the model list, consider which status should mark a successful build.
- Return to My models.
- Find nyc-taxi-fare-model in the model list.
You will see nyc-taxi-fare-model with a Ready status.
- Select nyc-taxi-fare-model.
- Select the current model version.
You will see the model evaluation metrics for the trained version. You have turned the report's weak-feature finding into visible evidence of model performance.
Model not reaching Ready?
- Keep Canvas open until the documented build window has passed.
- Request a quota increase if post-building analysis mentions ml.m5.2xlarge instances.
Help me diagnose why my SageMaker Canvas Quick build is not reaching Ready.
Secret mission
Test a What-If Taxi Fare
Turn your model evaluation into a controlled what-if experiment. Change only Trip distance to generate two numeric fare predictions and download the result as a CSV file.
Clean Up Your Resources
Clean Up Your Resources
Your cleanup choice determines which project resources stay available. Amazon SageMaker Canvas uses pay-as-you-go resources that can continue generating charges.
Cost warning
Canvas workspace sessions cost $1.9/hour outside eligible free-tier usage. Logging out ends workspace instance billing.
Canvas also provisions 100 GB of Amazon EBS gp3 persistent storage. This storage remains billable while its Canvas space exists.
Training and prediction are separate cost categories. The single-prediction endpoint shuts down after two idle hours.
Resources you used:
- The SageMaker Canvas application with its persistent storage space.
- The saved SageMaker Data Wrangler flow with its Data Quality and Insights report.
- The nyc-taxi-sample Canvas dataset.
- The nyc-taxi-fare-model model with its single-prediction results.
- System-managed Canvas objects in Amazon S3 under a bucket matching s3://sagemaker-{Region}-{your-account-id}.
- The SageMaker Canvas user profile with the project-specific SageMaker AI domain if you created that domain for this project.
- The downloaded prediction results CSV file on your computer.
Keep everything running
No action needed. Choose this only if you are continuing your Canvas work immediately.
- Your Canvas workspace session keeps running until you log out or an administrator ends the application.
- Your flow, report, dataset, model, and prediction results remain available in Canvas.
- Your persistent storage space remains available and can continue generating charges.
- Your single-prediction endpoint shuts down automatically after two idle hours.
Pause - I'll come back to this later
Logging out stops workspace instance billing. It preserves your models and datasets for a later session.
- Return to the Canvas application from earlier.
- Choose Log out in the left panel.
- Keep the downloaded prediction results CSV file in its current location.
Your workspace session is now stopped. Persistent storage charges can continue while the Canvas space exists.
What Happens to the Prediction Endpoint?
The endpoint used for your single prediction shuts down after two idle hours. Prediction charges can apply until that shutdown completes.
Delete - I don't want to use this again
This is the one cleanup choice you cannot undo. The checks below protect any shared domain or bucket content.
Protect Shared AWS Resources
Delete the user profile or domain only if you created it solely for this project. Keep any shared domain that supports other SageMaker users or workloads.
The system-managed S3 bucket can also contain unrelated SageMaker objects. Remove only the objects associated with this taxi project.
Remove the Canvas assets:
- Return to the Canvas application from earlier.
- Remove nyc-taxi-fare-model from My models.
- Remove nyc-taxi-sample from the Canvas dataset list.
- Remove the Data Quality and Insights report associated with the taxi flow.
- Remove the saved taxi flow from Data Wrangler.
- Choose Log out in the left panel.
The named taxi model, dataset, report, and flow should no longer appear in Canvas.
Clear the project-only apps and spaces:
- Return to the AWS Management Console in the selected AWS Region.
- Open Admin configurations.
- Choose domains.
- Select the domain used for this project.
- Open the User profiles tab.
- Delete each app launched by the project-only user profile.
- Delete each space owned by the project-only user profile.
Delete the project-only user profile:
- Select the project-only user profile.
- Choose Edit.
- Choose Delete user.
- Enter delete when prompted for confirmation.
- Choose Delete.
The deleted profile should disappear from the User profiles tab. Deleting the profile also removes its Canvas space and ends the charge for that space.
Remove the project-only domain:
- Return to the domain details page only if you created the domain solely for this project.
- Delete the project-only domain from its details page.
- Confirm that the project-only domain no longer appears under domains.
Review the system-managed S3 objects:
- Open Amazon S3 in the AWS Management Console.
- Locate the bucket matching s3://sagemaker-{Region}-{your-account-id}.
- Remove only the Canvas objects associated with this taxi project.
- Confirm that those project objects no longer appear in the bucket.
Finish the local cleanup:
- Delete the prediction results CSV from the location where your browser saved it.
- Open AWS Cost Explorer after cleanup to check whether SageMaker charges continue for the selected Region.
Nice Work!
Nice Work!
You made it! You built a managed regression workflow in Amazon SageMaker Canvas that estimates NYC taxi fares from trip features. You can now show the full path from cloud-hosted data to a numeric prediction.
You've learned how to:
- Imported the official NYC taxi dataset from Amazon S3 into SageMaker Data Wrangler. Previewed its tabular schema before making modeling assumptions.
- Used a Data Quality and Insights report to identify weak features for predicting Fare amount. Removed year plus hour_of_day before training.
- Trained a numeric prediction model named nyc-taxi-fare-model with Quick build. Confirmed its Ready status. Opened its evaluation metrics to assess the result.
- Secret Mission: Completed a what-if fare experiment by changing only Trip distance. Compared two numeric predictions. Downloaded the result as a CSV artifact.
Ready to quiz yourself?