/data-science-on-aws

AI and Machine Learning with Kubeflow, Amazon EKS, and SageMaker

Primary LanguageJupyter NotebookApache License 2.0Apache-2.0

Data Science on AWS - O'Reilly Book

Get the book on Amazon.com!

Data Science on AWS

Book Outline

Book Outline

Book Examples (12 hours)

Throughout these book examples, you will build an end-to-end AI/ML pipeline for natural language processing with Amazon SageMaker. You will train and tune a text classifier to predict the star rating (1 is bad, 5 is good) for product reviews using the state-of-the-art BERT model for language representation. To build our BERT-based NLP text classifier, you will use a product reviews dataset where each record contains some review text and a star rating (1-5). You will also get hands-on with advanced model training and deployment techniques such as hyper-parameter tuning, A/B testing, and auto-scaling. Lastly, you will setup a real-time, streaming analytics and data science pipeline to perform window-based aggregations and anomaly detection.

Learning Objectives for the Book Examples

Attendees will learn how to do the following:

  • Ingest data into S3 using Amazon Athena and the Parquet data format
  • Visualize data with pandas, matplotlib on SageMaker notebooks
  • Detect statistical data bias with SageMaker Clarify
  • Perform feature engineering on a raw dataset using Scikit-Learn and SageMaker Processing Jobs
  • Store and share features using SageMaker Feature Store
  • Train and evaluate a custom BERT model using TensorFlow, Keras, and SageMaker Training Jobs
  • Evaluate the model using SageMaker Processing Jobs
  • Track model artifacts using Amazon SageMaker ML Lineage Tracking
  • Run model bias and explainability analysis with SageMaker Clarify
  • Register and version models using SageMaker Model Registry
  • Deploy a model to a REST endpoint using SageMaker Hosting and SageMaker Endpoints
  • Automate ML workflow steps by building end-to-end model pipelines using SageMaker Pipelines, Airflow, AWS Step Functions, Kubeflow Pipelines, TFX, and MLflow
  • Perform automated machine learning (AutoML) to find the best model from just your dataset with low-code
  • Find the best hyper-parameters for your custom model using SageMaker Hyper-parameter Tuning Jobs
  • Deploy multiple model variants into a live, production A/B test to compare online performance, live-shift prediction traffic, and autoscale the winning variant using SageMaker Hosting and SageMaker Endpoints
  • Setup a streaming analytics and continuous machine learning application using Amazon Kinesis and SageMaker

Instructions to Run the Book Examples

0. Create an AWS Account if you don't already have one

Follow the instructions here:

1. Login to AWS Console

Console

2. Launch SageMaker Studio

In the AWS Console search bar, type SageMaker and select Amazon SageMaker to open the service console.

Notebook Instances

Quick Start

Pending Studio

Open Studio

Loading Studio

3. Update IAM Role

Open the AWS Management Console

Configure IAM to run the book examples.

IAM 1

IAM 2

IAM 3

Back to SageMaker

4. Launch a New Terminal within Studio

Click File > New > Terminal to launch a terminal in your Jupyter instance.

Terminal Studio

5. Clone this GitHub Repo in the Terminal

Within the Terminal, run the following:

cd ~ && git clone -b main https://github.com/data-science-on-aws/oreilly_book

If you see an error like the following, just re-run the command again until it works:

fatal: Unable to create '/home/sagemaker-user/oreilly_book/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.

Note: This is not a fatal error ^^ above ^^. Just re-run the command again until it works.

6. Start the Book Examples!

Navigate to oreilly_book/ in SageMaker Studio and start the book examples!!

You may need to refresh your browser if you don't see the new oreilly_book/ directory.

Start Workshop