Machine Learning With AWS SageMaker
See how you can take out the complexity of machine learning with SageMaker.
Join the DZone community and get the full member experience.
Join For FreeBusinesses are demanding the use of AI and ML to get more from their existing processes and software applications. However, typical software development teams are not always staffed with data scientists or ML engineers. They have application developers who find hard-to-decipher ML algorithms but lack specialized programming skills. Amazon Web Services offers a service known as SageMaker, which takes out the complexity of machine learning.
Why AWS SageMaker
SageMaker is a managed service offering from AWS with the intent of simplifying the process of building, training, and deploying machine learning models. Typically, developers have to spend a lot of time and effort during various stages of incorporating machine learning in their applications. They have to first find the right sources to collate the training data and then find the best algorithm as per their need. They will also set up training environments and start training the model mostly through trial and error. And finally, they will deploy the model on production. But the peril does not end here; the team also has to scale and manage the production environment.
SageMaker takes away most of these troubles. Below is a screenshot of SageMaker Dashboard:
Given below are three major steps in creating a successful machine learning model:
Build
A good machine learning model requires large volumes of data — which is hard to collate — and a manual labeling process, which may take several weeks to complete. AWS offers SageMaker GroundTruth, which uses machine learning to automatically label data and results in considerable time savings. GroundTruth can also work hand-in-hand with manual labeling. This actually makes GroundTruth even better in labeling over a period of time. Where GroundTruth has high confidence is in the results it obtained previously. There, it will apply labels automatically on similar raw data, else it will forward the data for manual intervention.
SageMaker further provides a hosted notebook environment based on the Jupyter notebook format. This environment is used for the exploration and visualization of data. It also integrates with other AWS services like S3 and Glue.
SageMaker provides some highly performant algorithms like XGBoost, linear classification, and PCA or principal components analysis. It also supports reinforcement learning algorithms like Intel Coach and Ray RL. It provides pre-configured frameworks like TensorFlow, PyTorch, SparkML, Apache MXNet, etc.
Train
Training in SageMaker is very easy. Simply specify the S3 location containing data, choose the number and types of instances where the computing will be done, and launch the training by clicking a button in the AWS Console. SageMaker applies the algorithm you chose, builds the cluster of auto-scaling instances, and applies the chosen algorithm.
Automatic Model Tuning is another salient feature of SageMaker. Typically, to train data, you need to provide a variety of data to the model and provide the hyperparameters. SageMaker helps you with the first part by applying machine learning to ascertain the kind and variety of data to apply. It learns the effect that a particular type of data has on the tuning of the model and then subsequently applies that learning on the data.
Usually, once a model has been trained it works well on the given platform. But what about a scenario where you may wish to deploy this model on another platform or cloud. This would subtle changes in the model to help adapt to the change in hardware of the platform. In such a scenario, SageMaker Neo helps you. It optimizes your model to work on different hardware configurations and processors.
Deploy
Deployment of your model using SageMaker gives you all the benefits of a Cloud provider — it is here that you truly utilize the Cloud power. Using the AWS Console, you deploy the model on a cluster of highly available compute instances that auto-scale as needed. Just like other AWS Compute services, SageMaker also takes care of monitoring the health of instances, ensures security by applying patches, and takes care of their maintenance. SageMaker integrates with CloudWatch where suitable metrics can be set up and alarms can be triggered so that timely action can be taken. It also connects with CloudWatch Logs, where you can see and debug your model's execution.
Compare SageMaker With Google and Azure
A quick comparison of ML services provided by major Cloud providers reveals the following:
AWS SageMaker and IBM Watson ML Studio offer built-in algorithms while Azure ML Services and Google ML Engine do not.
There is no local testing possible with SageMaker, and you will have to use the hosted environment only. For doing small tests and PoC, this can be an expensive proposition. Other Clouds make use of local compute also.
While AWS SageMaker is an end-to-end service that does all of the building, training, and deploying, Google Cloud Datalab is only for building and training. It can, however, be used in conjunction with Google Cloud ML to complete the pipeline.
Opinions expressed by DZone contributors are their own.
Comments