Reader small image

You're reading from  Data Engineering with AWS - Second Edition

Product typeBook
Published inOct 2023
PublisherPackt
ISBN-139781804614426
Edition2nd Edition
Right arrow
Author (1)
Gareth Eagar
Gareth Eagar
author image
Gareth Eagar

Gareth Eagar has over 25 years of experience in the IT industry, starting in South Africa, working in the United Kingdom for a while, and now based in the USA. Having worked at AWS since 2017, Gareth has broad experience with a variety of AWS services, and deep expertise around building data platforms on AWS. While Gareth currently works as a Solutions Architect, he has also worked in AWS Professional Services, helping architect and implement data platforms for global customers. Gareth frequently speaks on data related topics.
Read more about Gareth Eagar

Right arrow

Enabling Artificial Intelligence and Machine Learning

For a long time, organizations could only dream of the competitive advantage they would get if they could accurately forecast demand for their products, personalize recommendations for their customers, and automate complex tasks. And yet, advancements in machine learning (ML) over the past decade or so have made many of these things, and much more, a reality.

ML describes the process of training computers in a way that mimics how humans learn to perform several tasks. ML uses a variety of advanced algorithms and, in most cases, large amounts of data to develop and train an ML model. This model can then be used to examine new data and automatically draw insights from that data.

The difference between AI and ML is not always clear, and people tend to use the terms somewhat interchangeably. AI focuses on creating machines to perform tasks that typically require human intelligence, such as problem-solving, decision-making,...

Technical requirements

In the last section of this chapter, we will go through a hands-on exercise that uses Amazon SQS and AWS Lambda, to send some text to the Amazon Comprehend service so that we can extract insights from it.

As with the other hands-on activities in this book, if you have access to an administrator user in your AWS account, you should have the permissions needed to complete these activities. If not, you will need to ensure that your user is granted access to create Amazon SQS and AWS Lambda resources, as well as at least read-only permissions for Amazon Comprehend APIs.

You can find the code files of this chapter in the GitHub repository using the following link: https://github.com/PacktPublishing/Data-Engineering-with-AWS-2nd-edition/tree/main/Chapter13

Understanding the value of ML and AI for organizations

More and more companies, of all sizes, are in various stages in the journey of discovering how ML and AI can positively impact their business. While initially, only the largest of organizations had the money and expertise to invest in ML projects, over time, the required technology has become more affordable and more accessible to non-specialist developers.

Cloud providers, such as AWS, have played a big part in making ML and AI technology more accessible to a wider group of users. Today, a developer with no previous ML education or experience can use a service such as Amazon Lex to create a customer service chatbot. This chatbot will allow customers to ask questions using natural language, rather than having to select from a menu of preset choices. Not all that long ago, anyone wanting to create a chatbot like this would have needed a Ph.D. in ML!

Many large organizations still look to build up data science teams with...

Exploring AWS services for ML

AWS has three broad categories of ML and AI services, as illustrated in the following diagram (note that only a small sample of AI and ML services are included in this diagram, due to space constraints):

Figure 13.1: Amazon ML/AI stack

In the preceding diagram, we can see a subset of the services that AWS offers in each category – Artificial Intelligence Services, Machine Learning Services, and Machine Learning Frameworks and Infrastructure.

At the ML framework and infrastructure level, AWS provides Amazon Machine Images (AMIs) and prebuilt Docker containers that have popular deep learning ML frameworks pre-installed and optimized for the AWS environment. While these are useful for advanced use cases that require custom ML environments, these use cases are beyond the scope of this book.

For more information on these ML frameworks, refer to the AWS documentation on AWS Deep Learning AMIs (https://aws.amazon.com/machine...

Exploring AWS services for AI

While Amazon SageMaker simplifies building custom ML models, there are many use cases where a custom model is not required, and a generalized ML model will meet requirements.

For example, if you need to translate from one language into another, that will most likely not require a customized ML model. Existing, generalized models, trained for the languages you are translating between, would work.

You could use SageMaker to develop a French to English translation model, train the model, and then host the model on a SageMaker inference endpoint. But that would take time and would have compute costs associated with each phase of development (data preparation, notebooks, training, and inference).

Instead, it would be massively simpler, quicker, and cheaper to use an AI service such as Amazon Translate, which already has a model trained for this task. This service provides a simple API that can be used to pass in text in one language and receive...

Building generative AI solutions on AWS

In November 2022, a company called OpenAI launched ChatGPT, a chatbot built on a new type of ML technology. This very quickly went viral and became a world-wide sensation, as people were amazed at the ability of this new chatbot to have conversations on just about any topic. OpenAI explained the abilities of this new chatbot as follows:

We’ve trained a model called ChapGPT which interacts in a conversational way. The dialogue format makes it possible for ChaptGPT to answer follow-up questions, admit its mistakes, challenge incorrect premises, and reject inappropriate requests.

Using AWS services, it is possible for anyone to create new solutions or services that take advantage of the same type of technology that powers ChatGPT. But before we get into the AWS services that can be used for generative AI, let’s have a brief look at the details of the technology behind these new machine learning services.

...

Common use cases for LLMs

LLMs by design are very versatile, meaning that this technology can be applied to many different potential use cases. For example, you could create a chatbot application that makes use of LLM technology and acts like an unhappy customer. You could then use this as part of the training for your call center staff, to train them on dealing with unhappy customers and evaluate how well they handle the “customer.”

You could also build a Q&A chatbot that is connected to some of your internal datasets (such as FAQ documents), enabling users to ask questions using natural language and to get answers that come from your official corporate documents.

There are many other common use cases, as well as many use cases that are yet to be discovered. To review some of the common use cases and understand how you can use Amazon Bedrock for these use cases, see the Amazon Bedrock workshop at https://github.com/aws-samples/amazon-bedrock-workshop....

Hands-on – reviewing reviews with Amazon Comprehend

Imagine that you work for a large hotel chain and have been tasked with developing a process for identifying negative reviews that have been posted on your website. This will help the customer service teams follow up with the customer.

If your company was getting hundreds of reviews every day, it would be time-consuming to have someone read the entire review every time a new review was posted. Luckily, you have recently heard about Amazon Comprehend, so you decide to develop a small Proof of Concept (PoC) test to see whether Amazon Comprehend can help.

If your PoC is successful, you will want to have a decoupled process that receives reviews once they have been posted, calls Amazon Comprehend to determine the sentiment of the review, and then takes a follow-up action if the review is negative or mixed. Therefore, you decide to build your PoC in the same way, using Amazon Simple Queue Service (SQS) to receive reviews...

Summary

In this chapter, you learned more about the broad range of AWS ML and AI services that AWS provides, and had the opportunity to get hands-on with Amazon Comprehend, an AI service for extracting insights from written text.

We discussed how ML and AI services can apply to a broad range of use cases, both specialized (such as detecting cancer early) and general (business forecasting or personalization).

We examined different AWS services related to ML and AI. We looked at how different Amazon SageMaker capabilities can be used to prepare data for ML, build models, train and fine-tune models, and deploy and manage models. SageMaker makes building custom ML models much more accessible to developers without existing expertise in ML.

We then looked at a range of AWS AI services that provide prebuilt and trained models for common use cases. We looked at services for transcribing text from audio files (Amazon Transcribe), for extracting text from forms and handwritten...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Data Engineering with AWS - Second Edition
Published in: Oct 2023Publisher: PacktISBN-13: 9781804614426
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Gareth Eagar

Gareth Eagar has over 25 years of experience in the IT industry, starting in South Africa, working in the United Kingdom for a while, and now based in the USA. Having worked at AWS since 2017, Gareth has broad experience with a variety of AWS services, and deep expertise around building data platforms on AWS. While Gareth currently works as a Solutions Architect, he has also worked in AWS Professional Services, helping architect and implement data platforms for global customers. Gareth frequently speaks on data related topics.
Read more about Gareth Eagar