How To Use AWS Sagemaker

In this post, I will explain how to use AWS Sagemaker. Even if you do not have experience with this AWS service, this guide will help understand AWS Sagemaker step by step.

What is AWS Sagemaker?

AWS Sagemaker is a new web service that AWS offers. It helps to build, train and deploy machine learning models at any scale.  Basically, Sagemaker does the heavy lifting of machine learning and as a developer or data scientist, you can focus on building and training your model.

Major Benefits of AWS Sagemaker

  • You can easily fetch or store data from other AWS Services
  • Highly Scalable. This again relates to my earlier point by being able to connect to other AWS Services.
  • Does heavy lifting of ML algorithms – Fast training

Details Of Machine Learning and Sagemaker

Machine learning is literally machine learning about something. Nevertheless, that something can be anything that humans are usually good at or bad at. Machine Learning provides an ability for systems to learn and improve from experience.

In another way, you can say a system with a feedback loop. A system performs functions, gathers data along the way, uses that data to improve the functions it is performing.

Building a model

Sagemaker makes it easy to connect with AWS Services like S3, Database. Sagemaker also includes Juypter notebooks. These notebooks make it easier to visualize data.

Sagemaker also offers a set of algorithms pre-installed. Sagemaker also comes in with preconfigured TensorFlow or Apache MXNet.

Training and Deploying a model

I will show later in this post how we can train a model in Sagemaker with a single click. The important thing to note here is that you can easily train a model for petabyte-scale in Sagemaker. With continuous improvement, Sagemaker can also improve the performance of the model.

Once you train and tune the model in Sagemaker, it is easy to deploy the model in production. Sagemaker deploys the model on an auto-scaling cluster of EC2 instances.

A simple example of using AWS Sagemaker

  1. Once, you log in to the AWS console, access Sagemaker service. Select Notebook Instances and create a Jupyter Notebook instance as shown below:

How to Use AWS Sagemaker - Notebook Instance

2. On the next page, keep the most default settings as shown. You will need to create an IAM role for S3 bucket creation. If you don’t have that role, you can create it while selecting the role.

3.  Once you select the role, click “create a notebook instance” and it will create a notebook instance. It will take few minutes before it will show it is running. Once the notebook instance is running, click “open” and it will open Jupyter notebook in another tab.

4. Select notebook environment as conda_python3 or anything that you want to use.

Once you have the notebook opened, you can use python or the language of your choice to build a model. For the model, you can easily fetch data from S3 or relational databases from AWS service.

I will not be showing that part in this post. But if you want to refer to a good example, you can visit this post here.

Conclusion

In this post, I showed how one can use AWS Sagemaker to build and train the model for machine learning.

You can subscribe to my blog here.