Use the AWS Comprehend ML API to predict topics, sentiment, and other aspects of text input.
- [Instructor] To start, we're going to work with AWS Comprehend for natural language processing. It will identify in text entities, key phrases, language and sentiment. It also can do topic modeling, and as of this recording, the interface is in English or Spanish. So I type comprehend, and click Get started.
And this takes us immediately into the API explorer and presents us with the results of the analysis. So you can see that we've got some sample text here on the left side in the API explorer. On the right side, we have Entity information, so we can see the category, these are types of entities, the count and here's the confidence, or the P value or the predicted score. If I scroll down, we have key phrases, same situation.
Scroll down, here's the language. And here is the sentiment. So it's a neutral tone. So I'm just going to type some text in here, and then we'll reanalyze it. All right, and I'm going to click Analyze. Have I spelt Carpenteria right? Probably not, I'll just say Santa Barbara.
Can never spell my city. And click Analyze. And you can see there's been some additional detections here. So today, Lynda.com, Santa Barbara, California, and if I scroll down, the sentiment is now positive, because the weather is beautiful and I feel happy to be teaching. So that is how this API works in terms of identifying the various entities, key phrases, language and sentiment.
Now the second aspect of this API is working with the Topic modeling. So let's click on that. And let's click Create. So I'm going to use some of Amazon's sample data, and pre-populate this. I'm going to call it demo-job. And then I'm going to select an output bucket that I've created in advance. So this one. And then I'm going to need an IAM role, because I've got the service interacting with S3.
And I'm going to call this demo-ml, and click Create job. All right, my job's in progress, so I'm going to click into it. And now my job has completed. And if I scroll down, under the actions. There's the output data location, which is right over here, and there's my output, which I've downloaded and opened in an editor.
And you can see we have two files. The first one is document topics, and the second one is topic terms. Notice that in the first file, we have docname, topic and proportion; in the second, topic, term and weight. All right, as I mentioned when in introduced the top of Amazon machine learning APIs, I said in addition to exploring what they do, I would share at least one use case for how they can be integrated into business scenarios.
So let's do that now. So a business scenario that can work with Comprehend is managing a call center. And here is an example architecture. So you have some input coming in, maybe from social media or from somebody's phone. And that information is stored in S3. So the text data and the call transcriptions are in an S3 data lake. And then Comprehend processes the text to extract key phrases, entities and sentiment for further analysis.
In this scenario, the results are dumped not into S3, but into Redshift. And this is done so the data can be analyzed in aggregate to understand what actions lead to the most positive customer outcomes. And of course, this can be used by business analysts to determine how to provide more emphasis to the positive outcomes and to reduce the emphasis on the actions that are resulting in negative outcomes.
- Describe business scenarios that benefit from machine learning.
- Identify the different types of algorithms used in machine learning.
- Explain how Rekognition is used to predict image and video labels.
- Demonstrate how to use custom machine learning algorithms with SageMaker.
- Compare and contrast deep learning and traditional learning.
- Summarize how VariantSpark is used when working with genomic scale data.