0% found this document useful (0 votes)
108 views709 pages

SAAI3-AI Analyst 2022-Course Guide

Uploaded by

eng.reen.moh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views709 pages

SAAI3-AI Analyst 2022-Course Guide

Uploaded by

eng.reen.moh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 709

V12.

cover

Front cover
Notebook
Artificial Intelligence Analyst 2022
Course code SAAI ERC 3.0

Ahmed Abdel-Baky
Heba Aboulmagd
Nouran Attia
Islam Helal
Norhan Khaled
Dina Sayed

IBM Training
July 2022 edition
Notices
This information was developed for products and services offered in the US.
IBM may not offer the products, services, or features discussed in this document in other countries. Consult your local IBM
representative for information on the products and services currently available in your area. Any reference to an IBM product, program,
or service is not intended to state or imply that only that IBM product, program, or service may be used. Any functionally equivalent
product, program, or service that does not infringe any IBM intellectual property right may be used instead. However, it is the user's
responsibility to evaluate and verify the operation of any non-IBM product, program, or service.
IBM may have patents or pending patent applications covering subject matter described in this document. The furnishing of this
document does not grant you any license to these patents. You can send license inquiries, in writing, to:
IBM Director of Licensing
IBM Corporation
North Castle Drive, MD-NC119
Armonk, NY 10504-1785
United States of America
INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some jurisdictions do not allow disclaimer of express or implied
warranties in certain transactions, therefore, this statement may not apply to you.
This information could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein;
these changes will be incorporated in new editions of the publication. IBM may make improvements and/or changes in the product(s)
and/or the program(s) described in this publication at any time without notice.
Any references in this information to non-IBM websites are provided for convenience only and do not in any manner serve as an
endorsement of those websites. The materials at those websites are not part of the materials for this IBM product and use of those
websites is at your own risk.
IBM may use or distribute any of the information you provide in any way it believes appropriate without incurring any obligation to you.
Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other
publicly available sources. IBM has not tested those products and cannot confirm the accuracy of performance, compatibility or any
other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of
those products.
This information contains examples of data and reports used in daily business operations. To illustrate them as completely as possible,
the examples include the names of individuals, companies, brands, and products. All of these names are fictitious and any similarity to
actual people or business enterprises is entirely coincidental.
Trademarks
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corp., registered in many
jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM
trademarks is available on the web at “Copyright and trademark information” at www.ibm.com/legal/copytrade.shtml.
© Copyright International Business Machines Corporation 2018, 2022.
This document may not be reproduced in whole or in part without the prior written permission of IBM.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
V12.0
Contents

TOC

Contents
Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv

Course description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi

Agenda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii

Unit 1. Introduction to machine learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
1.1. What is machine learning? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
What is machine learning? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Machine learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
What is a statistical model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7
1.2. Machine learning algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8
Machine learning algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9
Machine learning algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-10
Machine learning approaches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-11
Machine learning approaches (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-12
Machine learning approaches (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-13
Machine learning approaches (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-14
Machine learning algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-15
Naïve Bayes classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-16
Naïve Bayes classification (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-17
Naïve Bayes classification (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-18
Naïve Bayes classification (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-19
Naïve Bayes classification (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-20
Naïve Bayes classification (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-21
Naïve Bayes classification (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-22
Naïve Bayes classification (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-23
Linear regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-24
Linear regression (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-25
Linear regression (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-26
Linear regression (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-27
Linear regression (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-28
Linear regression (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-29
Linear regression (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-30
Linear regression (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-31
Logistic regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-32
Logistic regression (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-33
Logistic regression (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-34
Logistic regression (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-35
Support vector machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-36
Support vector machine (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-37
Decision tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-38
Decision tree (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-39
Decision tree (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-40
Decision tree (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-41
Decision tree (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-42
Decision tree (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-43
K-mean clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-44

© Copyright IBM Corp. 2018, 2022 iii


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Contents

TOC K-means clustering (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-45


K-means clustering (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-46
K-means clustering (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-47
K-means clustering (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-48
K-means clustering (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-49
K-means clustering (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-50
K-means clustering (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-51
1.3. What are neural networks? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-52
What are neural networks? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-53
Neural networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-54
Neural networks (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-55
Neural networks (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-56
Perceptron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-57
Neural networks: Backpropagation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-58
1.4. What is deep learning? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-59
What is deep learning? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-60
Deep learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-61
Deep learning (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-62
1.5. How to evaluate a machine learning model? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-63
How to evaluate a machine learning model? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-64
Model evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-65
Model evaluation (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-66
Model evaluation (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-67
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-69
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-70
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-71
Exercise: Applying machine learning algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-72
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-73

Unit 2. Introduction to IBM Watson . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
2.1. IBM Watson overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
IBM Watson overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
IBM Watson . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
IBM Watson history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
IBM Watson relies on data, information, and expertise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
IBM Watson services offerings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
2.2. IBM Watson services on IBM Cloud . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-10
IBM Watson services on IBM Cloud . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-11
Watson services on IBM Cloud - Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-12
Watson Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-14
Watson Discovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-15
Natural Language Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-16
Speech to Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-17
Text to Speech . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-19
Language Translator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-21
Watson Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-22
Watson Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-24
Knowledge Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-26
Watson OpenScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-27
2.3. Build with Watson . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-28
Build with Watson . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-29
Building AI solutions with IBM Watson services on IBM Cloud . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-30
Watson services and domain adaptation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-31
Watson services and domain adaptation (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-32

© Copyright IBM Corp. 2018, 2022 iv


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Contents

TOC Getting started with Watson services on IBM Cloud . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-34


Watson SDKs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-35
Additional resources for developers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-36
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-37
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-38
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-39
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-40
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-41
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-42
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-43
Exercise: Exploring IBM Watson services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-44
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-45

Unit 3. Introduction to IBM Watson Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
3.1. Watson Studio overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
Watson Studio overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
What is Watson Studio? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Correct tool for the correct job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
Industry use cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
Watson Studio offerings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-10
Watson Studio high availability (public cloud) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-12
3.2. Watson Studio components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-13
Watson Studio components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-14
Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-15
Creating a project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-17
Watson Studio and Cloud Object Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-18
Creating a project and defining its storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-19
Watson Studio project tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-20
Watson Studio project tabs: Manage tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-22
Assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-23
Watson Studio Gallery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-24
Collaborating in a project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-25
Watson Studio and Spark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-27
Spark default environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-28
3.3. Jupyter notebooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-29
Jupyter notebooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-30
Jupyter notebooks overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-31
Parts of a notebook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-32
Creating notebooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-34
Creating notebooks (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-35
Coding and running notebooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-37
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-39
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-40
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-41
Exercise: Getting started with Watson Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-43
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-44

Unit 4. Introduction to IBM Watson Machine Learning and AutoAI . . . . . . . . . . . . . . . . . . . . . . . . 4-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
4.1. Cross-Industry Standard Process for Data Mining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Cross-Industry Standard Process for Data Mining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
Cross-Industry Standard Process for Data Mining overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
CRISP-DM lifecycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7

© Copyright IBM Corp. 2018, 2022 v


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Contents

TOC Phases in CRISP-DM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8


4.2. Data preparation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Data preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-10
Data preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-11
Data selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-12
Data selection: Samples selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-14
Data selection: Survey sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-15
Data preprocessing: Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-16
Data preprocessing: Steps overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-17
Data transformation: Steps overview (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-18
4.3. Watson Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-19
Watson Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-20
Watson Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-21
Watson Machine Learning features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-22
Watson Machine Learning personas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-23
Watson Machine Learning: Building the model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-24
Watson Machine Learning: Building the model (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-25
Exercise 4 – Section 1: Getting started with Watson Machine Learning . . . . . . . . . . . . . . . . . . . . . . .4-26
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-27
4.4. AutoAI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-28
AutoAI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-29
What is AutoAI or AutoML? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-30
AutoAI process: Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-31
AutoAI terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-33
Exercise 4 – Section 2: Creating an AutoAI experiment from marketing data . . . . . . . . . . . . . . . . . .4-34
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-35
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-36
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-37
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-38
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-39
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-40
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-41
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-42
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-43
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-44
Exercise: Building and deploying a regression analysis model with Watson Machine Learning . . . .4-45
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-46

Unit 5. Introduction to natural language processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
5.1. Natural language processing overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
Natural language processing overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5
What is natural language processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6
Natural language processing applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7
Natural language processing challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8
5.2. Natural language processing use cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9
Natural language processing use cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-10
Natural language processing use cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-11
Natural language processing use cases (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-12
Natural language processing use cases (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-13
5.3. Natural language processing basic concepts and terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-14
Natural language processing basic concepts and terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-15
Basic concepts and terminologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-16
Basic concepts and terminologies (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-17
Basic concepts and terminologies (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-18

© Copyright IBM Corp. 2018, 2022 vi


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Contents

TOC Basic concepts and terminologies (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-19


Basic concepts and terminologies (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-20
5.4. Natural language processing tools and services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-21
Natural language processing tools and services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-22
Natural language processing tools and services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-23
Natural language processing tools and services (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-25
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-26
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-27
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-28
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-29
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-30

Unit 6. Natural language processing concepts and components . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3
6.1. Natural language processing categories. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
Natural language processing categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5
Natural language processing categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6
NLU applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7
NLG applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8
6.2. Language ambiguities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9
Language ambiguities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-10
Language ambiguities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-11
Language ambiguities (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-12
6.3. Natural language processing phases and pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-13
Natural language processing phases and pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-14
Natural language processing phases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-15
Natural language processing pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-18
Natural language processing pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-19
Natural language processing pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-20
Natural language processing pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-21
Natural language processing pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-22
Porter stemmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-23
Natural language processing pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-24
Natural language processing pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-25
Natural language processing pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-26
Natural language processing pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-28
Natural language processing pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-30
Natural language processing pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-31
Natural language processing pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-32
6.4. Information retrieval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-33
Information retrieval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-34
Information retrieval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-35
Information retrieval system steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-36
Information retrieval systems main processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-37
Term Frequency and Inverse Document Frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-38
6.5. Information extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-39
Information extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-40
Information extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-41
Information extraction (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-42
Information extraction (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-43
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-44
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-45
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-46
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-47
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-48

© Copyright IBM Corp. 2018, 2022 vii


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Contents

TOC Unit 7. Natural language processing evaluation metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
System evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
System evaluation (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
System evaluation (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5
System evaluation (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6
System evaluation (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7
System evaluation (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8
System evaluation (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9
System evaluation (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-10
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-11
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-12
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-13
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-14
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-15

Unit 8. Natural language processing and IBM Watson. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3
8.1. Watson NLP services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
Watson NLP services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5
Watson NLP services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6
Information extraction by using Watson services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7
8.2. Watson Natural Language Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8
Watson Natural Language Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-9
Watson Natural Language Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-10
Watson Natural Language Understanding – Tone analytics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-12
Natural Language Understanding demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-13
Natural Language Understanding demo – Entities extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-14
Natural Language Understanding demo – Keywords extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-15
Natural Language Understanding demo – Concepts extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-16
Natural Language Understanding demo – Relations extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-17
Natural Language Understanding demo – Sentiment analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-18
Natural Language Understanding demo – Emotion analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-19
Natural Language Understanding demo – Categories classification . . . . . . . . . . . . . . . . . . . . . . . . . . .8-20
Natural Language Understanding demo – Semantic roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-21
Natural Language Understanding demo – Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-22
Natural Language Understanding demo – Custom entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-23
Natural Language Understanding demo – Custom relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-24
8.3. Watson Discovery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-25
Watson Discovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-26
Watson Discovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-27
Watson Discovery flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-29
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-30
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-31
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-32
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-33
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-34
Exercise: Ingesting, converting, enriching, and querying data with the IBM Watson Discovery service 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-35
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-36

Unit 9. Introduction to IBM Watson Knowledge Studio. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3
9.1. IBM Watson Knowledge Studio overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4

© Copyright IBM Corp. 2018, 2022 viii


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Contents

TOC IBM Watson Knowledge Studio overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5


Watson Knowledge Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6
Watson Knowledge Studio (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7
Build a machine learning model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-8
Building a machine learning model (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-9
Building a rule-based model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-10
Building a rule-based model (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-11
Machine learning based model versus a rule-based model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-12
Why do we need Watson Knowledge Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-13
Why do we need Watson Knowledge Studio (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-14
Watson Knowledge Studio demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-15
Watson Knowledge Studio integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-16
9.2. Watson Knowledge Studio features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-17
Watson Knowledge Studio features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-18
Creating a workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-19
Workspace resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-20
Type system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-21
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-22
Dictionary usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-23
Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-24
9.3. Adapting the system to a new domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-25
Adapting the system to a new domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-26
Model life cycle: End-to-end domain adaptation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-27
Knowledge curation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-28
Ground truth generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-30
Model development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-32
Model evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-34
Model deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-35
End-to-end domain adaptation wrap-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-36
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-38
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-39
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-40
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-41
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-42
Exercise: Creating a machine learning model with Watson Knowledge Studio . . . . . . . . . . . . . . . . . .9-43
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-44

Unit 10. Introduction to chatbots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-2
Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-3
10.1. Chatbots overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-4
Chatbots overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-5
What is a chatbot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-6
Chatbots in the industry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-7
Chatbots in the industry (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-8
Chatbot history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-9
Why now . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-11
Popular chatbots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-12
Popular chatbots (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-13
10.2. Chatbots design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-14
Chatbots design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-15
Chatbot design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-16
Chatbot design: Positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-18
Chatbot design: Positioning (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-19
Chatbot design: Positioning (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-20
Chatbot design: Positioning (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22

© Copyright IBM Corp. 2018, 2022 ix


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Contents

TOC Chatbot design: Positioning (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-23


Chatbot design: Positioning (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-24
Chatbot design: Tone and personality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-25
Chatbot design: Tone and personality (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-26
Chatbot design: Tone and personality (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-27
Chatbot design: Tone and personality for purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-28
Chatbot design: Tone and personality for viewpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-29
Chatbot design: Tone and personality for proactivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-30
Chatbot design: Design issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-31
10.3. Chatbots tools and services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-32
Chatbots tools and services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-33
Chatbots tools and services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-34
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-36
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-37
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-38
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-39
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-40

Unit 11. Introduction to IBM Watson Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-2
Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-3
11.1. Watson Assistant experiences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-4
Watson Assistant experiences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-5
About Watson Assistant experiences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-6
New Watson Assistant experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-7
Classic Watson Assistant experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-9
11.2. New Watson Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-11
New Watson Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-12
The new Watson Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-13
Building your assistant with Action and Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-15
Actions benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-17
Creating your first assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-18
Creating your first assistant (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-19
Creating your first Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-20
Creating your first Step – Step 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-21
Creating your first Step – Step 1 (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-22
Trying out your action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-23
Adding more steps to the conversation – Step 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-24
Adding logic (conditions) to the flow – Step 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-25
Adding an agent handoff step – Step 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-26
Inserting the context to pass to the human agent – Step 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-27
Handoff to agent step wrap-up – Step 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-28
Creating a final response – Step 4 (1 of 5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-29
Creating a final response – Step 4 (2 of 5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-30
Creating a final response – Step 4 (3 of 5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-31
Creating a final response – Step 4 (4 of 5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-32
Creating a final response – Step 4 (5 of 5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-33
Try it out (1 of 2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-34
Get a real-life preview of your assistant: Preview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-35
11.3. Classic Watson Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-36
Classic Watson Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-37
When to use classic Watson Assistant? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-38
Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-40
Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-41
Dialog skill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-42
Intent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-43

© Copyright IBM Corp. 2018, 2022 x


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Contents

TOC Intent (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-44


Entity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-45
Entity evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-46
Entity evaluation (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-47
Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-48
Dialog (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-49
Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-50
Responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-51
Rich responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-52
Multiple (conditional) responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-53
Watson Assistant dialog features (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-54
Dialog flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-55
Watson Assistant components (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-56
Switching the experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-57
11.4. Migrating to the new experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-58
Migrating to the new experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-59
Deciding which experience to use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-60
Migrating intents and entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-62
Activating dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-64
Migrating skills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-65
Calling actions from a dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-66
When to call an action from a dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-68
11.5. Enriching the chatbot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-70
Enriching the chatbot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-71
Persona . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-72
Emotion and tone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-73
Integrations page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-74
Integrations: Essential channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-75
Integrations: Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-77
Integrations: Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-79
Speech recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-80
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-81
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-82
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-83
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-84
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-85
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-86
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-87
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-88
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-89
Exercise: Getting started with Watson Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-90
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-91
Exercise: Help Desk Chatbot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-92
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-93
Exercise: Exploring the new Watson Assistant: Creating a retail customer service chatbot . . . . . 11-94
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-95

Unit 12. Introduction to computer vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-2
What is computer vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-3
How does computer vision work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-4
How does computer vision work (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-6
Computer vision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-8
Computer vision applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-9
Computer vision applications (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-10
Computer vision tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11

© Copyright IBM Corp. 2018, 2022 xi


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Contents

TOC Computer vision tasks (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12


Computer vision tasks (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-14
Computer vision tasks (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-15
Computer vision tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-16
Computer vision tools (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-17
Computer vision tools (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-19
Computer vision use cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-21
Computer vision use cases (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-22
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-23
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-24
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-25
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-26
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-27

Unit 13. Computer vision fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-2
Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-3
13.1. Image representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-4
Image representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-5
Image representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-6
Image representation (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-8
13.2. Computer vision pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-9
Computer vision pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-10
Computer vision pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-11
Computer vision pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-12
Computer vision pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-13
Computer vision pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-14
Computer vision pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-16
Computer vision pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-18
Computer vision pipeline (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-19
Decision making . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-20
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-21
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-22
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-23
Exercise: Using a basic deep neural network to solve an image recognition problem . . . . . . . . . . 13-24
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-25

Unit 14. Designing and building an intelligent solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-2
Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-3
14.1. Integrating IBM Watson services to build a solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-4
Integrating IBM Watson services to build a solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-5
Benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-6
Building solutions with Watson services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-7
Resources for the integration of Watson services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-8
14.2. Watson Assistant integration with other services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-9
Watson Assistant integration with other services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-10
Watson Assistant integration: General outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-11
Customer experience integrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-13
Key concepts to enable Watson Assistant integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-14
Key concepts to enable Watson Assistant integration (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-15
Key concepts to enable Watson Assistant integration (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-16
Key concepts to enable Watson Assistant integration (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-17
Key concepts to enable Watson Assistant integration (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-18
Extending your assistant with webhooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-19
Making programmatic calls from a dialog node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-21

© Copyright IBM Corp. 2018, 2022 xii


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Contents

TOC Making programmatic calls from dialog nodes (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-22


Making programmatic calls from a dialog node (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-23
Watson Assistant integration architecture with Cloud Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-24
Integrating the new Watson Assistant with other services by using extensions . . . . . . . . . . . . . . 14-25
Adding custom extensions to Watson Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-27
Using extensions from Action steps: Extension setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-28
Using extensions from Action steps: API response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-29
14.3. Building a cognitive chatbot banking app: Integrating Watson Assistant, Watson Discovery, Natural
Language Understanding, and back-end banking services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-30
Building a cognitive chatbot banking app: Integrating Watson Assistant, Watson Discovery, Natural
Language Understanding, and back-end banking services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-31
Integration example: Cognitive banking chatbot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-32
Cognitive banking chatbot integration flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-33
14.4. Building an intelligent procurement system by integrating Knowledge Studio and Watson Discovery
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-34
Building an intelligent procurement system by integrating Knowledge Studio and Watson Discovery 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-35
Intelligent procurement system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-36
Intelligent procurement system integration flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-37
14.5. Building a movie recommender solution with Watson Assistant, Watson Studio, Machine Learning,
Db2, and Node-RED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-38
Building a movie recommender solution with Watson Assistant, Watson Studio, Machine Learning, Db2,
and Node-RED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-39
Movie recommender system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-40
Movie recommender integration architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-41
Watson Assistant and Node-RED integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-42
Node-RED and DB2 integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-43
Node-RED and Machine Learning service integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-44
Machine Learning and Watson Studio integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-45
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-46
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-47
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-48
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-49
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-50
Exercise: Building a chatbot and movie recommender solution with Watson services and Node-RED 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-51
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-52

Unit 15. Getting started with AI ethics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-1


Unit objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-2
Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-3
15.1. Introduction to AI ethics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-4
Introduction to AI ethics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-5
AI ethics (trusted AI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-6
IBM’s principles for trust and transparency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-7
Foundational properties for AI ethics: The pillars of trust . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-9
Explainability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-10
Fairness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-11
Robustness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-12
Transparency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-13
Privacy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-14
Trustworthy AI toolkits - AI Explainability 360 toolkit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-15
Trustworthy AI toolkits – AI Fairness 360 toolkit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-17
Trustworthy AI toolkits - Adversarial Robustness 360 toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-18
Trustworthy AI toolkits – AI FactSheets 360 tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-19
Trustworthy AI toolkits – Uncertainty Quantification 360 toolkit . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-20

© Copyright IBM Corp. 2018, 2022 xiii


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Contents

TOC IBM Cloud Pak for Data and trustworthy AI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-21


Responsible AI tools for TensorFlow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-22
Microsoft responsible AI principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-24
Microsoft Responsible AI Toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-26
15.2. Intoduction to Watson OpenScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-28
Intoduction to Watson OpenScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-29
What is Watson OpenScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-30
Components of Watson OpenScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-31
Monitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-32
Supported machine learning engines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-33
15.3. Monitoring fairness in ML models with OpenScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-35
Monitoring fairness in ML models with OpenScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-36
Fairness and bias in machine learning models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-37
Fairness monitor key concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-38
Fairness monitor key concepts (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-40
Configuring the fairness monitor - Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-42
Configuring the fairness monitor – Favorable outcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-43
Configuring the fairness monitor – Sample size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-44
How it works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-45
Example of a bias model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-47
How it works (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-48
The fairness timeline view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-49
15.4. Explaining decisions made by ML models with OpenScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-51
Explaining decisions made by ML models with OpenScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-52
Explaining transaction: Types of explanations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-53
Viewing explanations by transaction ID: Transactions list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-55
Transaction details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-56
Run analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-57
Run analysis - Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-58
Explaining image models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-59
Explaining unstructured text models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-60
Unit summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-61
Review questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-62
Review questions (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-63
Review answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-64
Review answers (cont.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-65
Exercise: Monitoring fairness in a credit risk prediction model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-66
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-67
Exercise: Monitoring weather conditions bias in a model that predicts telecommunications call drops 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-68
Exercise objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-69

© Copyright IBM Corp. 2018, 2022 xiv


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Trademarks

TMK

Trademarks
The reader should recognize that the following terms, which appear in the content of this training
document, are official trademarks of IBM or other companies:
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International
Business Machines Corp., registered in many jurisdictions worldwide.
The following are trademarks of International Business Machines Corporation, registered in many
jurisdictions worldwide:
Cloudant® Db2® IBM Cloud®
IBM Cloud Pak® IBM Research® IBM Watson®
Maximo® OpenWhisk® Resource®
SPSS® Think® With Watson®
Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.
Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other
countries, or both.
Java™ is a trademark or registered trademark of Oniqua Pty. Ltd., an IBM Company.
RStudio® and Shiny® are registered trademarks of RStudio, Inc.
Social® is a trademark or registered trademark of TWC Product and Technology, LLC, an IBM
Company.
Other product and service names might be trademarks of IBM or other companies.

© Copyright IBM Corp. 2018, 2022 xv


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Course description

pref

Course description
Artificial Intelligence Analyst 2022

Duration: 5 days

Purpose
The Artificial Intelligence Analyst career path prepares students to apply AI concepts to build
real-life solutions. This career path introduces students to basic concepts of AI, machine learning
algorithms, natural language processing, chatbots, and computer vision. Students apply the
concepts they learn to practical examples by using IBM Watson services and tools on IBM Cloud

Audience
• Undergraduate senior students from IT related academic programs, for example, computer
science, software engineering, information systems and others.
• IT and business professionals who want to explore how AI technologies can be applied to
solve business problems or build business solutions.

Prerequisites
Before attending Module III AI Analyst classroom, students must meet the following
prerequisites:
• Successful completion of Module I AI Overview (self-study).
• Successful completion of Module II Prerequisites (self-study).
• Successful completion of Exercise 0, Setting up your hands-on environment.

Objectives
After completing this course, you should be able to:
• Explain what artificial intelligence (AI) is.
• Describe the field of AI and its subfields: Machine learning, natural language processing (NLP),
and computer vision.
• List applications of AI in the industry and government.
• Describe machine learning.
• Describe different type of machine learning algorithms.
• Apply machine learning algorithms to specific problems.
• Explain deep learning.
• Explain convolutional neural networks and neural networks.

© Copyright IBM Corp. 2018, 2022 xvi


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Course description

pref • Describe examples of unsupervised and supervised learning.


• Describe IBM Watson.
• Explain how IBM Watson technology is applied to solve real world problems.
• Explain the capabilities of the IBM Watson services.
• Describe IBM Watson Studio, its components, and key applications.
• Describe the CRISP-DM process model and explain where machine learning fits in the CRISP-
DM process.
• Create machine learning models for different machine learning algorithms by using IBM
Watson Studio.
• Explain the benefits of AutoAI.
• Explain domain adaptation.
• Describe the purpose of training the various IBM Watson services.
• Describe IBM Watson Knowledge Studio capabilities and use.
• Explain what natural language processing (NLP) is.
• List tools and services for NLP.
• Identify NLP use cases.
• Explain main NLP concepts.
• Explain how to evaluate the quality of an NLP algorithm.
• Identify the IBM Watson services that are based on NLP technology.
• Use IBM Watson Discovery to build a cognitive query application.
• Describe chatbot applications and chatbots design guidelines.
• Explain core concepts and artifacts needed to build a chatbot application.
• Build chatbot applications with IBM Watson Assistant.
• Explain what computer vision is.
• Identify computer vision use cases.
• Explain how computer vision analyzes and processes images and describe commonly used
computer vision techniques.
• Integrate multiple IBM Watson services to build a comprehensive intelligent solution.
• Explain AI ethics and trusted AI.
• Describe the principles that are defined by major providers of AI technologies in support of
responsible and trusted AI.
• List open source tools that are available to support trustworthy AI, transparency, and
explainability.
• Provide an overview of Watson OpenScale and explain how it is used to explain decisions that
are made by ML models.
• Explain how fairness is configured and monitored by Watson OpenScale.

© Copyright IBM Corp. 2018, 2022 xvii


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Agenda

pref

Agenda

Note

The following unit and exercise durations are estimates, and might not reflect every class
experience.

Day 1
(00:30) Welcome
(01:30) Unit 1 - Introduction to machine learning
(01:00) Exercise 1 - Applying machine learning algorithms
(01:00) Unit 2 - Introduction to IBM Watson
(01:00) Exercise 2 - Exploring IBM Watson services

Day 2
(00:30) Unit 3 - Introduction to IBM Watson Studio
(01:30) Exercise 3 - Getting started with IBM Watson Studio
(01:00) Unit 4 - Introduction to IBM Watson Machine Learning and AutoAI
(01:00) Exercise 4 Section 1 - Getting started with IBM Watson Machine Learning
(01:00) Exercise 4 Section 2 - Creating an AutoAI experiment from marketing data
(00:45) Exercise 5 - Building and deploying a regression analysis model with Watson Machine
Learning

Day 3
(00:30) Unit 5 - Introduction to natural language processing
(00:30) Unit 6 - Natural language processing concepts and components
(00:30) Unit 7 - Natural language processing evaluation metrics
(00:30) Unit 8 - Natural language processing and IBM Watson
(01:30) Exercise 6 - Ingesting, converting, enriching, and querying data with the IBM Watson
Discovery service
(00:45) Unit 9 - Introduction to IBM Watson Knowledge Studio
(01:30) Exercise 7 - Creating a machine learning model with Watson Knowledge Studio

© Copyright IBM Corp. 2018, 2022 xviii


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Agenda

pref
Day 4
(00:30) Unit 10 - Introduction to chatbots
(01:30) Unit 11 - Introduction to IBM Watson Assistant
(00:45) Exercise 8 - Getting started with IBM Watson Assistant
(01:30) Exercise 9 - Help Desk chatbot
(01:00) Exercise 10 - Exploring the new Watson Assistant: Creating a retail customer service
chatbot
(00:30) Unit 12 - Introduction to computer vision
(00:30) Unit 13 - Computer vision fundamentals
(01:00) Exercise 11 - Using a basic deep neural network to solve an image recognition problem

Day 5
(01:00) Unit 14 - Designing and building an intelligent solution
(02:00) Exercise 12 - Building a chatbot and movie recommender solution with Watson services
and Node-RED
(01:30) Unit 15- Getting started with AI ethics
(01:00) Exercise 13 - Monitoring fairness in a credit risk prediction model
(01:00) Exercise 14 - Monitoring weather conditions bias in a model that predicts
telecommunications call drops

© Copyright IBM Corp. 2018, 2022 xix


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Unit 1. Introduction to machine learning


Estimated time
01:30

Overview
This unit recaps the main topics in Module I, AI overview and provides a deeper view into complex
subjects, such as:
• Machine learning
• Machine learning algorithms
• Neural networks
• Deep learning

© Copyright IBM Corp. 2018, 2022 1-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Unit objectives • Explain what is machine learning


• Describe what is meant by statistical model and algorithm
• Describe machine learning types and approaches (Supervised,
Unsupervised and Reinforcement)
• List different machine learning algorithms
• Explain what neural networks and deep learning are, and why they
are important in today’s AI field
• Explain how to evaluate your machine learning model

© Copyright IBM Corporation 2018, 2022

Figure 1-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 1-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Topics • What is machine learning?


• Machine learning algorithms
• What are neural networks?
• What is deep learning?
• How to evaluate a machine learning model?

© Copyright IBM Corporation 2018, 2022

Figure 1-2. Topics

© Copyright IBM Corp. 2018, 2022 1-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty
1.1. What is machine learning?

© Copyright IBM Corp. 2018, 2022 1-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

What is machine
learning?

Figure 1-3. What is machine learning?

© Copyright IBM Corp. 2018, 2022 1-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Machine learning
• In 1959, the term “machine learning” was first introduced by Arthur Samuel. He defined it as
the “field of study that gives computers the ability to learn without being explicitly
programmed”.
• The learning process improves the machine model over time by using training data.
• The evolved model is used to make future predictions.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-4. Machine learning

Arthur Samuel, former IBM engineer and a professor at Stanford, was one of the pioneers in the
field of computer gaming and artificial intelligence. He was the first one to introduce the term
“machine learning”. Machine learning is a field of artificial intelligence. It uses statistical methods
to give computer the ability to "learn" from data, without being explicitly programmed.
If a computer program can improve how it performs certain tasks based on past experiences, then
it has learned. This differs from performing the task always the same way because it has been
programmed to do so.
The learning process improves the so-called “model” over time by using different data points
(training data). The evolved model is used to make future predictions.
References:
Machine Learning
https://link.springer.com/chapter/10.1007/978-1-4302-5990-9_1
Automated Design of Both the Topology and Sizing of Analog Electrical Circuits Using Genetic
Programming
https://link.springer.com/chapter/10.1007/978-94-009-0279-4_9

© Copyright IBM Corp. 2018, 2022 1-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

What is a statistical model


• A model in a computer is a mathematical function that represents a relationship or mapping
between a set of inputs and a set of outputs.

• New data “X” can predict the output “Y”.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-5. What is a statistical model

The representation of a model in the computer is in the form of a mathematical function. It is a


relationship or mapping between a set of inputs and a set of outputs. For example, f(x)=x^2.
Assume that a system is fed with data indicating that the rates of violent crime are higher when
the weather is warmer and more pleasant, even rising sharply during warmer-than-typical winter
days. Then, this model can predict the crime rate for this year compared to last year’s rates based
on the weather forecast.
Returning to the mathematical representation of the model that can predict crime rate based on
temperature, we might propose the following mathematical model:
Violent crime incidents per day = Average Temperature × 2
This is an oversimplified example to explain that machine learning refers to a set of techniques for
estimating functions (for example, predicting crime incidents) that is based on data sets (pairs of
the day’s average temperature and the associated number of crime incidents). These models can
be used for predictions of future data.

© Copyright IBM Corp. 2018, 2022 1-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty
1.2. Machine learning algorithms

© Copyright IBM Corp. 2018, 2022 1-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Machine learning
algorithms

Figure 1-6. Machine learning algorithms

© Copyright IBM Corp. 2018, 2022 1-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Machine learning algorithms


• The machine learning algorithm is a technique through which the system extracts useful
patterns from historical data. These patterns can be applied to new data.
• The objective is to have the system learn a specific input/output transformation.
• The data quality is critical to the accuracy of the machine learning results.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-7. Machine learning algorithms

To estimate the function that represents the model, an appropriate learning algorithm must be
used. In this context, the learning algorithm represents the technique through which the system
extracts useful patterns from the input historical data. These patterns can be applied to new data
in new situations. The objective is to have the system learn a specific input/output transformation
and to make future predictions for a new data point. Finding the appropriate algorithms to solve
complex problems in various domains and knowing how and when to apply them is an important
skill that machine learning engineers should acquire. Because the machine learning algorithms
depend on data, understanding and acquiring data with high quality is crucial for accurate results.

© Copyright IBM Corp. 2018, 2022 1-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Machine learning approaches


1) Supervised learning: Train by using labeled data, and learn and predict new labels for unseen
input data.

• Classification is the task of predicting a discrete class label, such as “black, white, or gray” and
“tumor or not tumor”.

• Regression is the task of predicting a continuous quantity, such as “weight”, “probability”, and
“cost”.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-8. Machine learning approaches

Supervised learning is one of the main categories of machine learning. In supervised machine
learning, input data (also known as training examples) comes with a label, and the goal of learning
is to predict the label for new, unforeseen examples. A supervised learning algorithm analyzes the
training data and produces an inferred function, which can be used for mapping new examples.
In practice, the problems that are solved by using supervised learning are grouped into either
regression or classification problems.
Classification is the task of predicting a discrete class label, such as “black, white, or gray” and
“tumor or not tumor”.
Regression is the task of predicting a continuous quantity, such as “weight”, “probability” and
“cost”.

© Copyright IBM Corp. 2018, 2022 1-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Machine learning approaches (cont.)


2) Unsupervised learning: Detect patterns and relationships between data without using
labeled data.

• Clustering algorithms: Discover how to split the data set into a number of groups such that
the data points in the same groups are more similar to each other compared to data points in
other groups.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-9. Machine learning approaches (cont.)

Unsupervised learning is a machine learning type that learns from data that has not been
labeled. The goal of unsupervised learning is to detect patterns in the data. One of the most
popular types of unsupervised learning is clustering algorithms.
Clustering algorithms are algorithms that discover how to split the data set into a number of
groups such that the data points in the same groups are more similar to each other compared to
data points in other groups.

© Copyright IBM Corp. 2018, 2022 1-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Machine learning approaches (cont.)


3) Semi-supervised learning:

• A machine learning technique that falls between supervised and unsupervised learning.

• It includes some labeled data with a large amount of unlabeled data.

• Here is an example that uses pseudo-labeling:


a. Use labeled data to train a model.

b. Use the model to predict labels for the unlabeled data.

c. Use the labeled data and the newly generated labeled data to create a new model.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-10. Machine learning approaches (cont.)

Many real practical problems fall into this category of machine learning where you have little
labeled data and the rest of the data is unlabeled.
Labeling data is an expensive or time-consuming process. In addition, it mandates having domain
experts to label data accurately. Think about labeling skin diseases images that must be labeled
by a domain expert. Also, too much labeling data might introduce human biases into the model.
In semi-supervised learning, you try to get the best out of your unlabeled data. There are different
techniques to achieve this task. For example, you can use pseudo-labeling, which aims to give
approximate labels to unlabeled data. Pseudo-labeling works as follows:
1. Use labeled data to train a model.
2. Use the model to predict labels for the unlabeled data.
3. Use the labeled data and the newly generated labeled data to create a model.
References:
Introduction to Pseudo-Labelling : A Semi-Supervised learning technique
https://www.analyticsvidhya.com/blog/2017/09/pseudo-labelling-semi-supervised-learning-tec
hnique/

© Copyright IBM Corp. 2018, 2022 1-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Machine learning approaches (cont.)


4) Reinforcement learning

• Reinforcement learning uses trial and error (a rewarding approach).

• The algorithm discovers an association between the goal and the sequence of events that
leads to a successful outcome.

• Example reinforcement learning applications:


ƒ Robotics: A robot that must find its way.

ƒ Self-driving cars.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-11. Machine learning approaches (cont.)

Reinforcement learning is a goal-oriented learning that is based on interaction with the


environment. As the system performs certain actions, it finds out more about the world.
Reinforcement learns through trial and error (a rewarding approach).
The algorithm discovers an association between the goal and the sequence of events that leads to
a successful outcome.
Example reinforcement learning problems:
• Robotics: A robot that must find its way.
• Self-driving cars.

© Copyright IBM Corp. 2018, 2022 1-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Machine learning algorithms


Understanding your problem and the different types of ML algorithms helps in selecting the best
algorithm.
Here are some machine learning algorithms:
• Naïve Bayes classification (supervised classification – probabilistic)
• Linear regression (supervised regression)
• Logistic regression (supervised classification)
• Support vector machine (SVM) (supervised linear or non-linear classification)
• Decision tree (supervised non-linear classification)
• K-means clustering (unsupervised learning)

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-12. Machine learning algorithms

In the following slides, we explore different machine learning algorithms. We describe the most
prominent algorithms. Each algorithm belongs to a category of learning. We explore supervised
and unsupervised algorithms, regression and classification algorithms, and linear and non-linear
classification.

© Copyright IBM Corp. 2018, 2022 1-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Naïve Bayes classification


• Naïve Bayes classifiers assume that the value of a particular feature is independent of the
value of any other feature, given the class variable.
ƒ For example, a fruit may be considered to be an apple if it is red, round, and about 10 cm in diameter.
ƒ Features: Color, roundness, and diameter.
ƒ Assumption: Each of these features contributes independently to the probability that this fruit is an
apple, regardless of any possible correlations between the color, roundness, and diameter features.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-13. Naïve Bayes classification

Naïve Bayes classifiers is a powerful and simple supervised machine learning algorithm. It
assumes that the value of a particular feature is independent of the value of any other feature,
given the class variable. For example, a fruit may be considered to be an apple if it is red, round,
and about 10 cm in diameter.
Features: Color, roundness, and diameter.
A Naïve Bayes classifier considers each of these features to contribute independently to the
probability that this fruit is an apple, regardless of any possible correlations between the color,
roundness, and diameter features.

© Copyright IBM Corp. 2018, 2022 1-16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Naïve Bayes classification (cont.)


• Example: Use Naïve Bayes to predict whether the Red, Round shaped, 10 cm diameter label is
an apple or not.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-14. Naïve Bayes classification (cont.)

Imagine that you have the data set that is shown in the table in this slide. The column with title “Is
Apple?” represents the label of the data. Our objective is to make a new prediction for an
unknown object. The unknown object has the following features:
• Color: Red
• Shape: Round
• Diameter: 10 cm
Note 1: Sometimes the terminology “parameters” or “variables” is used to describe the
“features”.
Note 2: “Annotated data” or “labeled data” refer to the same terminology.

© Copyright IBM Corp. 2018, 2022 1-17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Naïve Bayes classification (cont.)


To do a classification, you must perform the following steps:
1. Define two classes (Cy and CN) that correspond to Apple = Yes and Apple = No.
2. Compute the probability for Cy as x: p(Cy | x):
p(Apple = Yes | Colour = Red, Shape = round, Diameter => 10 cm)
3. Compute the probability for CN as x: p(CN | x):
p(Apple = No | Colour = Red, Shape = round, Diameter => 10 cm)
4. Discover which conditional probability is larger:
If p(Cy |x) > p(CN |x), then it is an apple.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-15. Naïve Bayes classification (cont.)

Your algorithm basically depends on calculating two probability values:


• Class probabilities: The probabilities of having each class in the training data set.
• Conditional probabilities: The probabilities of each input feature giving a specific class value.
The process for solving this problem is as follows:
1. Define two classes CY and CN that correspond to Apple = Yes and Apple = No.
2. Compute the probability for CY as x: p(CY | x): p(Apple = Yes | Colour = Red, Shape = round,
Diameter => 10 cm)
3. Compute the probability for CN as x: p(CN | x): p(Apple = No | Colour = Red, Shape = round,
Diameter => 10 cm)
4. Discover which conditional probability is larger: If p(CY |x) > p(CN |x), then it is an apple.

© Copyright IBM Corp. 2018, 2022 1-18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Naïve Bayes classification (cont.)

Naïve Bayes model:

5. Compute p(x|CY) = p(Colour = Red, Shape = round, Diameter =>10 cm | Apple = Yes).

Naïve Bayes assumes that the features of the input data (the apple parameters) are

independent.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-16. Naïve Bayes classification (cont.)

The Naïve Bayes formula is given by this model. Our target is to compute the formula to reach
p(CK |x), where K is any class (CY or CN).
5. Compute the conditional probability of having each feature given that the class is CY: p(x|CY)
= p(Colour = Red, Shape = round, Diameter =>10 cm | Apple = Yes).
Because Naïve Bayes assumes that the features of the input data (the object features) are
independent, to get the p(x|CY) value, we calculate the conditional probability of each feature at a
time with the class CY, and then multiply all the values.

© Copyright IBM Corp. 2018, 2022 1-19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Naïve Bayes classification (cont.)

Thus, we can rewrite p(x| CY) as:

= p(Colour = Red | Apple = Yes) X p(Shape = round | Apple = Yes) X p(Diameter => 10 cm | Apple = Yes)

Same for p(x| CN):

= p(Color = Red | Apple = No) X p(Shape = round | Apple = No) X p(Diameter => 10 cm | Apple = No)

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-17. Naïve Bayes classification (cont.)

Thus, we can rewrite p(x| CY) as:


= p(Colour = Red | Apple = Yes) X p(Shape = round | Apple = Yes) X p(Diameter => 10 cm | Apple =
Yes)
We apply the same rule for p(x| CN) by multiplying the conditional probabilities of reach input
feature given CN:
= p(Color = Red | Apple = No) X p(Shape = round | Apple = No) X p(Diameter => 10 cm | Apple =
No)

© Copyright IBM Corp. 2018, 2022 1-20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Naïve Bayes classification (cont.)


6. Calculate each conditional probability:
p(Colour = Red | Apple = Yes) = 3/5 (Out of five apples, three of them were red.)
p(Colour = Red | Apple = No) = 2/5
p(Shape = Round | Apple = Yes) = 4/5
p(Shape = Round | Apple = No) = 2/5
p(Diameter = > 10 cm | Apple = Yes) = 2/5
p(Diameter = > 10 cm | Apple = No) = 3/5

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-18. Naïve Bayes classification (cont.)

Let us see how to calculate these conditional probabilities. For example, to calculate p(Colour =
Red | Apple = Yes), you are asking, “What is the probability for having a red color object given that
we know that it is an apple”.
You browse the table to see how many “is Apple?” has a “yes” label. You see that the occurrence
is five times.
Now, from the table, how many of these five occurrences are when you have a color = red? You
find that there are three occurrences for red color. Therefore, p(Colour = Red | Apple = Yes) = 3/5.
Repeat these steps for the rest of the features.

© Copyright IBM Corp. 2018, 2022 1-21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Naïve Bayes classification (cont.)

• p(Color = Red | Apple = Yes) X p(Shape = round | Apple = Yes) X p(Diameter = > 10 cm | Apple = Yes)

= (3/5) x (4/5) x (2/5) = 0.192

• p(Color = Red | Apple = No) X p(Shape = round | Apple = No) X p(Diameter = > 10 cm | Apple = No)

= (2/5) x (2/5) x (3/5) = 0.096

• p(Apple = Yes) = 5/10

• p(Apple = No) = 5/10

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-19. Naïve Bayes classification (cont.)

Now, we have all the values that we need. As mentioned in step 5, we multiply the conditional
probabilities as follows:
p(Color = Red | Apple = Yes) X p(Shape = round | Apple = Yes) X p(Diameter = > 10 cm | Apple =
Yes)
= (3/5) x (4/5) x (2/5) = 0.192
p(Color = Red | Apple = No)p(Shape = round | Apple = No)p(Diameter = > 10 cm | Apple = No)
= (2/5) x (2/5) x (3/5) = 0.096
p(Apple = Yes) = 5/10
p(Apple = No) = 5/10

© Copyright IBM Corp. 2018, 2022 1-22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Naïve Bayes classification (cont.)

Compare p(CY | x) to p(CN | x):

Therefore, the verdict is that it is an apple.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-20. Naïve Bayes classification (cont.)

Finally, we compare the values of p(CY |x) versus p(CN |x). By substituting the values that were
calculated in the previous steps, we discover that p(CY |x) > p(CN |x), which means that the object
is an apple.

© Copyright IBM Corp. 2018, 2022 1-23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Linear regression
• Linear regression is a linear equation that combines a specific set of input values (X) and an
outcome (Y) that is the predicted output for that set of input values. As such, both the input
and output values are numeric.
• The target variable is a continuous value.
Examples for applications:
• Analyze the marketing effectiveness, pricing, and promotions on the sales of a product.
• Forecast sales by analyzing the monthly company’s sales for the past few years.
• Predict house prices with an increase in the sizes of houses.
• Calculate causal relationships between parameters in biological systems.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-21. Linear regression

Regression algorithms are one of the key algorithms that are used in machine learning. Regression
algorithms help analysts to model relationships between input variables X and the output label Y
for the training data points. This algorithm targets supervised regression problems, that is, the
target variable is a continuous value.
In simple linear regression, we establish a relationship between the target variable and input
variables by fitting a line that is known as the regression line.
There are different applications that benefit from linear regression:
• Analyze the marketing effectiveness, pricing, and promotions on the sales of a product.
• Forecast sales by analyzing the monthly company’s sales for the past few years.
• Predict house prices with an increase in the sizes of houses.
• Calculate causal relationships between parameters in biological systems.

© Copyright IBM Corp. 2018, 2022 1-24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Linear regression (cont.)


• Example: Assume that we are studying the real state market.
• Objective: Predict the price of a house given its size by using previous data.

Size Price

30 30,000

70 40,000

90 55,000

110 60,000

130 80,000

150 90,000

180 95,000

190 110,000

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-22. Linear regression (cont.)

Assume that we are studying the real state market and our objective is to predict the price of a
house given its size by using previous data. The label in this case is the price column.

© Copyright IBM Corp. 2018, 2022 1-25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Linear regression (cont.)


• Plot this data as a graph

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-23. Linear regression (cont.)

After plotting the points on the graph, they seem to be forming a line.

© Copyright IBM Corp. 2018, 2022 1-26


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Linear regression (cont.)


• Can you guess what is the best estimate for a price of a 140-meter square house?
• Which one is correct?
A. $60,000
Size Price
B. $95,000 30 30,000

C. $85,000 70 40,000

90 55,000

110 60,000

130 80,000

150 90,000

180 95,000

190 110,000

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-24. Linear regression (cont.)

You want to find the price value of a 140-meter square house. Which of the following choices is
correct?
1. $60,000
2. $95,000
3. $85,000

© Copyright IBM Corp. 2018, 2022 1-27


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Linear regression (cont.)


• Target: A line that is within a “proper” distance from all points.
• Error: The aggregated distance between data points and the assumed line.
• Solution: Calculate the error iteratively until you reach the most accurate line with a minimum
error value (that is, the minimum distance between the line and all points).

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-25. Linear regression (cont.)

To answer the question “What is the price for a 140-meter square house?”, we need to draw the
line that best fits most of the data points.
How we can find the line that best fits all the data points? We can draw many lines, so which one is
the best line?
The best line should have the minimal error value. The error refers to the aggregated distance
between data points and the assumed line. Calculate the error iteratively until you reach the most
accurate line with a minimum error value.

© Copyright IBM Corp. 2018, 2022 1-28


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Linear regression (cont.)


• After the learning process, you get the most accurate line, the bias, and the slope to draw your line.

• Here is our linear regression model representation for this problem:


h(p) = p0 + p1 * X1
or
Price = 30,000 + 392* Size
Price = 30,000 + 392* 140
= 85,000

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-26. Linear regression (cont.)

After the learning process, you get the most accurate line, the bias, and the slope to draw your
line.
p0 is the bias. It is also called the intercept because it determines where the line intercepts the y
axis.
p1 is the slope because it defines the slope of the line or how x correlates with a y value before
adding the bias.
If you have the optimum value of p0 and p1 , you can draw the line that best represents the data.

© Copyright IBM Corp. 2018, 2022 1-29


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Linear regression (cont.)


• Squared error function Æ
ƒ m is the number of samples.
ƒ is the predicted value for data point i.
• is the actual value for data point i.
Target: Choose P values to minimize errors.
• Stochastic Gradient descent algorithm:

ƒ j is the feature number.


ƒ is the learning rate.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-27. Linear regression (cont.)

The squared error function J is represented by the difference between the predicted point and the
actual points. It is calculated as follows:
J(P) = (1/(2*m)) Σ (hp (xi ) - yi)2
Where:
• i is the number of a sample or data point within the data set samples.
• hp (xi ) is the predicted value for data point i.
• yi is the actual value for data point i.
• m is the count of data set samples or data points.
We can use an optimization technique that is called stochastic gradient descent. The algorithm
evaluates and updates the weights on every iteration to minimize the model error. The technique
works iteratively. In each iteration, the training instance is exposed to the model once. The model
makes a prediction and the corresponding error is calculated. The model is updated to reduce the
error for the next prediction. The process continues to adjust the model weights to reach the
smallest error.
Here we use the gradient descent algorithm to iteratively get the values of p0 and p1 (the
intercept and slope of the line are also called weights) by the following algorithm:
Pj := Pj – α (hp (xi ) - yi) xj i
Where:
j is the feature number.
α is the learning rate.

© Copyright IBM Corp. 2018, 2022 1-30


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Linear regression (cont.)


• In higher dimensions where we have more than one input (X), the line is called a plane or a
hyper-plane.
• The equation can be generalized from simple linear regression to multiple linear regression as
follows:
ƒ Y(X)=p0+p1*X1+p2*X2+...+pn*Xn

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-28. Linear regression (cont.)

With more features, you do not have a line; instead, you have a plane. In higher dimensions where
we have more than one input (X), the line is called a plane or a hyper-plane.
The equation can be generalized from simple linear regression to multiple linear regression as
follows:
Y(X)=p0+p1*X1+p2*X2+...+pn*Xn

© Copyright IBM Corp. 2018, 2022 1-31


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Logistic regression
• Supervised classification algorithm.
• Target: A dependent variable (Y) is a discrete category or a class (not a continuous variable as
in linear regression).
ƒ Example: Class1 = Cancer, Class2 = No Cancer

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-29. Logistic regression

Logistic regression is a supervised classification algorithm. It is different from linear regression


where the dependent or output variable is a category or class. The target is a discrete category or
a class (not a continuous variable as in linear regression), for example, Class1 = cancer, Class2 =
No Cancer.

© Copyright IBM Corp. 2018, 2022 1-32


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Logistic regression (cont.)


• Logistic regression is named for the function that is used at the core of the algorithm.
• The logistic function (sigmoid function) is an S-shaped curve for data discrimination across
multiple classes. It can take any real value 0 – 1.

Logistic function

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-30. Logistic regression (cont.)

Logistic regression is named for the function that is used at the core of the algorithm, which is the
logistic function. The logistic function is also known as the sigmoid function. It is an S-shaped
curve (as shown in the figure) for data segregation across multiple classes that can take any real
value 0 - 1.

© Copyright IBM Corp. 2018, 2022 1-33


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Logistic regression (cont.)


• The sigmoid function squeezes the input value between [0,1].
• Logistic regression equation:
Y = exp(p0+p1X)/(1+exp(p0+p1X))

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-31. Logistic regression (cont.)

During the learning process, the system tries to generate a model (estimate a set of parameters
p0, p1, …) that can best predict the probability that Y will fall in class A or B given the input X. The
sigmoid function squeezes the input value between [0,1], so if the output is 0.77 it is closer to 1,
and the predicted class is 1.

© Copyright IBM Corp. 2018, 2022 1-34


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Logistic regression (cont.)


• Example: Assume that the estimated values of p’s for a certain model that predicts the gender
from a person’s height are p0= -120 and p1 = 0.5.
• Class 0 represents female and class 1 represents male.
• To compute the prediction, use:
Y = exp(-120+0.5X)/(1+exp(-120+0.5X))
Y = 0.00004539
ƒ P(male|height=150) is 0 in this case.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-32. Logistic regression (cont.)

Example: Assume that the estimated values of p’s for a certain model that predicts the gender
from a person’s height are p0= -120 and p1=0.5.
Assume that you have two classes where class 0 represents female and class 1 represents male.
Y = exp(-120+0.5X)/(1+exp(-120+0.5X))
Y = 0.00004539
P(male|height=150) is 0 in this case.

© Copyright IBM Corp. 2018, 2022 1-35


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Support vector machine


• The goal is to find a separating hyperplane between positive and negative examples of input
data.
• SVM is also called a “large Margin Classifier”.
• The SVM algorithm seeks the hyperplane with the largest margin, that is, the largest distance
to the nearest sample points.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-33. Support vector machine

SVM is a supervised learning model that can be a linear or non-linear classifier. SVM is also called
a “large Margin Classifier” because the algorithm seeks the hyperplane with the largest margin,
that is, the largest distance to the nearest sample points.

© Copyright IBM Corp. 2018, 2022 1-36


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Support vector machine (cont.)

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-34. Support vector machine (cont.)

Assume that a data set lies in a two-dimensional space and that the hyperplane will be a
one-dimensional line.
Although many lines (in light blue) do separate all instances correctly, there is only one optimal
hyperplane (red line) that maximizes the distance to the closest points (in yellow).

© Copyright IBM Corp. 2018, 2022 1-37


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Decision tree
• A supervised learning algorithm that uses a tree structure to model decisions.
• It resembles a flow-chart or if-else cases.
• An example for applications is general business decision-making like predicting customers’
willingness to purchase a given product in a given setting, for example, online versus a
physical store.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-35. Decision tree

A decision tree is a popular supervised learning algorithm that can be used for classification and
regression problems. Decision trees are a popular prediction method. Decision trees can explain
why a specific prediction was made by traversing the tree.
There are different examples for applications that can use decision tree in business. For example,
predicting customers’ willingness to purchase a given product in a given setting, for example,
online versus a physical store.

Note

In our scope, we focus on a classification tree.

© Copyright IBM Corp. 2018, 2022 1-38


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Decision tree (cont.)

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-36. Decision tree (cont.)

A decision tree includes three main entities: root node, decision nodes, and leaves. The figure
shows the graphical representation of these entities.
A decision tree builds the classification or regression model in the form of a tree structure. It
resembles a flowchart, and is easy to interpret because it breaks down a data set into smaller and
smaller subsets while building the associated decision tree.

© Copyright IBM Corp. 2018, 2022 1-39


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Decision tree (cont.)

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-37. Decision tree (cont.)

The “Play Tennis” example is one of the most popular examples to explain decision trees.
In the data set, the label is represented by “PlayTennis”. The features are the rest of the columns:
“Outlook”, “Temperature”, “Humidity”, and “Wind”. Our goal here is to predict, based on some
weather conditions, whether a player can play tennis or not.
Reference:
Choosing the Best Attribute
http://jmvidal.cse.sc.edu/talks/decisiontrees/choosingbest.html?style=White

© Copyright IBM Corp. 2018, 2022 1-40


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Decision tree (cont.)

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-38. Decision tree (cont.)

Back to the example, the decision tree representation on the right side of the figure shows the
following information:
• Each internal node tests an attribute.
• Each branch corresponds to an attribute value.
• Each leaf node assigns a classification.
Eventually, we want to make a classification of “if Play Tennis = {Yes, No}”.
Reference:
Choosing the Best Attribute
http://jmvidal.cse.sc.edu/talks/decisiontrees/choosingbest.html?style=White

© Copyright IBM Corp. 2018, 2022 1-41


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Decision tree (cont.)


A decision tree is built by making decisions regarding the following items:
• Which feature to choose as the root node
• What conditions to use for splitting
• When to stop splitting

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-39. Decision tree (cont.)

The algorithm works by recursively splitting the data based on the value of a feature. After each
split, the portion of the data becomes more homogeneous.
Now, the algorithm needs to decide:
1. Which feature to choose as the root node.
2. What conditions to use for splitting.
3. When to stop splitting.

© Copyright IBM Corp. 2018, 2022 1-42


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Decision tree (cont.)


• Using entropy and information gain to construct a decision tree.
• Entropy: It is the measure of the amount of uncertainty and randomness in a set of data for
the classification task.
• Information gain: It is used for ranking the attributes or features to split at given node in the
tree.
ƒ Information gain = (Entropy of distribution before the split)–(entropy of distribution after it)

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-40. Decision tree (cont.)

The Iterative Dichotomiser3 (ID3) algorithm works by using entropy and information gain to
construct a decision tree. Entropy is the measure of the amount of uncertainty and randomness in
a set of data for the classification task. Entropy is maximized when all points have equal
probabilities. If entropy is minimal, it means that the attribute or feature appears close to one
class and has a good discriminatory power for classification.
Entropy zero means that there is no randomness for this attribute.
Information gain is a metric that is used for ranking the attributes or features to split at given node
in the tree. It defines how much information a feature provides about a class. The feature with the
highest information gain is used for the first split.

© Copyright IBM Corp. 2018, 2022 1-43


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

K-mean clustering
• Unsupervised machine learning algorithm.
• It groups a set of objects in such a way that objects in the same group (called a cluster) are
more similar to each other than those in other groups (other clusters).

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-41. K-mean clustering

K-means clustering is an unsupervised machine learning technique. The main goal of the
algorithm is to group the data observations into k clusters, where each observation belongs to the
cluster with the nearest mean.
A cluster’s center is the centroid. The figure shown plots of the partition of a data set into five
clusters, with the cluster centroids shown as crosses.

© Copyright IBM Corp. 2018, 2022 1-44


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

K-means clustering (cont.)


• Examples for applications include customer segmentation, image segmentation, and
recommendation systems.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-42. K-means clustering (cont.)

Examples of applications include:


• Customer segmentation: Imagine that you are the owner of electronics store. You want to
understand preferences of your clients to expand your business. It is not possible to look at
each client’s purchase details to find a good marketing strategy. But, you can group the details
into, for example, five groups based on their purchasing habits. Then, you start building your
marketing strategy for each group.
• Image segmentation and compression: The process of partitioning a digital image into
multiple segments (sets of pixels) to simplify and change the representation of an image into
something that is more meaningful and easier to analyze. To achieve this task, we need a
process that assigns a label to every pixel in an image such that pixels with the same label
share certain features. The image in this slide is segmented and compressed into three
regions by using k-means clustering. With smaller number of clusters, it provides more image
compression but at the expense of less image quality.
• Recommendation systems: These systems help you find users with the same preferences to
build better recommendation systems.
References:
https://www.mathworks.com/help/examples/images/win64/SegmentGrayscaleImageUsingKMe
ansClusteringExample_02.png
https://www.mathworks.com/help/examples/images/win64/SegmentGrayscaleImageUsingKMe
ansClusteringExample_01.png

© Copyright IBM Corp. 2018, 2022 1-45


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

K-means clustering (cont.)


• Example: Given the following data points, use K-means clustering to partition data into two
clusters.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-43. K-means clustering (cont.)

Assume that you have the data points that are show in the figure. Your goal is to cluster each data
point into one of two groups. Thus, the cluster size is 2. C1 and C2 represent these two clusters.

© Copyright IBM Corp. 2018, 2022 1-46


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

K-means clustering (cont.)


• Set initial centroids are C1 (1,1) and C2 (2,1)

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-44. K-means clustering (cont.)

Assume initial centroids are C1, point (1,1) and C2, point (2,1)

© Copyright IBM Corp. 2018, 2022 1-47


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

K-means clustering (cont.)

Find a new centroid by usingÆ


Iteration 1:
• Now, we calculate for each point to which center it belongs. The result depends on the
distance between the center and the point (by using Euclidian distance):
ƒ Point 1: (1, 1) Æ d11 = Yes d12 = No
This means point1(2,2) belongs to C1 and not C2 because it is closer to C1.
ƒ Point 2: (2, 1) Æ d21 = No, d22 = Yes
ƒ Point 3: (4, 3) Æ d31 = No, d32 = Yes
ƒ Point 4: (5, 4) Æ d41 = No, d42 = Yes
• Now, we calculate the new centroid as follows:
ƒ C1 = (1, 1)
ƒ C2 = 1/3 ((2, 1) + (4, 3) + (5, 4)) = (3.67, 2.67)

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-45. K-means clustering (cont.)

To compute the centroid of a cluster, use an iterative process where each point is examined and
you determine whether it belongs to a specific cluster. Then, you compute the new centroid by
using the mean of all points.

© Copyright IBM Corp. 2018, 2022 1-48


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

K-means clustering (cont.)

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-46. K-means clustering (cont.)

As you see, the new points in red are the new centroids. We apply another iteration to find a better
centroid that represents each cluster.

© Copyright IBM Corp. 2018, 2022 1-49


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

K-means clustering (cont.)


Iteration 2:
• Point 1: (1, 1) Æ d11 = Yes, d12 = No
• Point 2: (2, 1) Æ d21 = Yes, d22 = No
• Point 3: (4, 3) Æ d31 = No, d32 = Yes
• Point 4: (5, 4) Æ d41 = No, d42 = Yes
Now, we calculate the new centroid as follows:
• C1 = 1/2 ((1, 1)+(2,1)) = (1.5,1)
• C2 = 1/2 ((4, 3) + (5, 4)) = (4,5, 3.5)

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-47. K-means clustering (cont.)

Now, we examine each point again against the centroid by using Euclidian distance and calculate
the new centroids (C1 and C2).

© Copyright IBM Corp. 2018, 2022 1-50


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

K-means clustering (cont.)

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-48. K-means clustering (cont.)

As you see, the new red centroids represent the centers of the two clusters. The algorithm stops
when the centroids do not change or change slightly, or if a maximum number of iterations are
defined.

© Copyright IBM Corp. 2018, 2022 1-51


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty
1.3. What are neural networks?

© Copyright IBM Corp. 2018, 2022 1-52


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

What are neural


networks?

Figure 1-49. What are neural networks?

© Copyright IBM Corp. 2018, 2022 1-53


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Neural networks
• Machine learning models that are inspired by the structure of the human brain.
• The human brain is estimated to have 100 billion neurons, and each neuron is connected to up
to 10,000 other neurons.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-50. Neural networks

Neural networks represent an information-processing paradigm that is inspired by the human


brain. In the brain, neurons are highly connected and communicate chemical signals through the
synapses (a junction between two nerve cells) between the axons and dendrites. The human brain
is estimated to have 100 billion neurons, with each neuron connected to up to 10,000 other
neurons.
The figure shows a representation of a network of neurons in the brain.
Reference:
Getting Started with Artificial Intelligence
https://developer.ibm.com/technologies/artificial-intelligence/

© Copyright IBM Corp. 2018, 2022 1-54


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Neural networks (cont.)


• Artificial neural networks are collections of interconnected “neurons” (called nodes) that work
together to transform input data to output data.
• Each node applies a mathematical transformation to the data it receives; it then passes its
result to the other nodes in its path.
• Examples for applications:
ƒ Object detection, tracking, and image and video analysis
ƒ Natural language processing (for example, machine translation)
ƒ Autonomous cars and robots

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-51. Neural networks (cont.)

Artificial neural networks communicate signals (numbers) through weights and activation
functions that activate neurons. Using a training algorithm, these networks adjust those weights
to solve a problem.
Each node applies a mathematical transformation to the data it receives; it then passes its result
to the other nodes in its path. Each connection between nodes represents a different parameter to
the model.
A neural network is useful for machine learning tasks that have too many features (millions). For
example:
• Object detection, tracking, and image and video analysis by using a Convolutional Neural
Network (CNN)
• Natural language processing tasks like speech recognition and machine translation by using a
recurrent neural network (RNN)
• Autonomous cars and robots (more complex neural networks)

© Copyright IBM Corp. 2018, 2022 1-55


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Neural networks (cont.)


• Three or more layers (an input layer, one or many hidden layers, and an output layer).
• Neural network models can adjust and learn as data changes.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-52. Neural networks (cont.)

A neural network is composed of three or more layers: an input layer, one or many hidden layers,
and an output layer. Data is imported through the input layer. Then, the data is modified in the
hidden and output layers based on the weights that are applied to their nodes. The typical neural
network can consist of thousands or even millions of simple processing nodes that are densely
interconnected.

© Copyright IBM Corp. 2018, 2022 1-56


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Perceptron
• A single neuron model and originator for the neural network.
• Similar to linear classification, where each input has weight.
• One bias.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-53. Perceptron

A perceptron is a single neuron model that was an originator for neural networks. It is similar to
linear regression. Each neuron has its own bias and slope (weights). For example, assume that a
neuron have two inputs (X1 and X2 ), so it requires three weights (P1, P2 and P0 ). The figure in this
slide shows a weight for each input and one for the bias.

© Copyright IBM Corp. 2018, 2022 1-57


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Neural networks: Backpropagation


Backpropagation is an algorithm for training neural networks that has many layers. It works in
two phases:
• First phase: The propagation of inputs through a neural network to the final layer (called
feedforward).
• Second phase: The algorithm computes an error. An error value is then calculated by using the
wanted output and the actual output for each output neuron in the network. The error value is
propagated backward through the weights of the network (adjusting the weights) beginning
with the output neurons through the hidden layer and to the input layer (as a function of the
contribution of the error).

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-54. Neural networks: Backpropagation

Backpropagation is an algorithm for training neural networks that have many layers. It works in
two phases:
• Propagation of inputs through a neural network to the final layer (called feedforward).
• The algorithm computes an error. An error value is then calculated by using the wanted output
and the actual output for each output neuron in the network. The error value is propagated
backward through the weights of the network (adjusting the weights) beginning with the
output neurons through the hidden layer and to the input layer (as a function of the
contribution of the error).
Backpropagation continues to be an important aspect of neural network learning. With faster and
cheaper computing resources, it continues to be applied to larger and denser networks.

© Copyright IBM Corp. 2018, 2022 1-58


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty
1.4. What is deep learning?

© Copyright IBM Corp. 2018, 2022 1-59


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

What is deep
learning?

Figure 1-55. What is deep learning?

© Copyright IBM Corp. 2018, 2022 1-60


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Deep learning
• Similar to a traditional neural network, but it has many more hidden layers.
• Deep learning has emerged now because of the following reasons:
ƒ Emergence of big data, which requires data processing scaling.
ƒ Improvement in processing power and the usage of GPUs to train neural networks.
ƒ Advancement in algorithms like the rectified linear unit (ReLU).

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-56. Deep learning

Deep learning is a machine learning technique that uses neural networks to learn. Although deep
learning is similar to a traditional neural network, it has many more hidden layers. The more
complex the problem, the more hidden layers there are in the model.
Deep learning has emerged now because of the following reasons:
• The continuous increase in big data requires data processing scaling to analyze and use this
data correctly.
• Improvement in processing power and the usage of GPUs to train neural networks.
• Advancement in algorithms like the rectified linear unit (ReLU) instead of the Sigmoid
algorithm helps make gradient descent converge faster.

© Copyright IBM Corp. 2018, 2022 1-61


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Deep learning (cont.)


Applications:
• Multilayer perceptron (MLP): Classification and regression, for example, a house price
prediction.
• Convolutional neural network (CNN): For image processing like facial recognition.
• Recurrent neural network (RNN): For one-dimensional sequence input data. Like audio and
languages.
• Hybrid neural network: Covering more complex neural networks, for example, autonomous
cars.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-57. Deep learning (cont.)

There are various types of neural networks. Each network is more suitable for a type of machine
learning problem. Here is an overview for these networks and their applications:
• Multilayer perceptron (MLP): A class of feed-forward artificial neural networks (ANNs). It is
useful in classification problems where inputs are assigned a class. It also works in regression
problems for a real-valued quantity like a house price prediction.
• Convolutional neural network (CNN): Takes an input as an image. It is useful for image
recognition problems like facial recognition.
• Recurrent neural network (RNN): Has a temporal nature where the input may be a function in
time, such as audio files. It is also used for one-dimensional sequence data. It is suitable for
inputs like audio and languages. It can be used in applications like speech recognition and
machine translation.
• Hybrid neural network: Covers more complex neural networks, for example, autonomous cars
that require processing images and work by using radar.
Reference:
When to Use MLP, CNN, and RNN Neural Networks
https://machinelearningmastery.com/when-to-use-mlp-cnn-and-rnn-neural-networks/

© Copyright IBM Corp. 2018, 2022 1-62


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty
1.5. How to evaluate a machine learning model?

© Copyright IBM Corp. 2018, 2022 1-63


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

How to evaluate a
machine learning
model?

Figure 1-58. How to evaluate a machine learning model?

© Copyright IBM Corp. 2018, 2022 1-64


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Model evaluation
• Overfitting occurs when a machine learning model can fit the training set perfectly and fails
with unseen future data.
ƒ Reason: Too many features are used or you are reusing training samples in testing.
ƒ Solution:
í Fewer features
í More data
í Cross-validation

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-59. Model evaluation

After you have successfully trained your model, you need a methodology to follow to evaluate
your machine learning model performance. A classic mistake is to use the same sample data that
is used in training to test a model, which produces a false perfect score. This is called “overfitting”
(also referred as “high variance”). The problem with overfitting is that your model fails at
predicting future unseen data.
Another case that can cause overfitting is where you have unbalanced data. For example, assume
that you are working on a data set for churn analysis. The customers who churned are actually 2%
of your data set. Using this data set “as is” causes overfitting.
The objective of a good machine learning model is to generalize for any future data points.
Overfitting also can occur if you are using too many features. Relatively, if the number of features
is the same as or greater than the number of training samples, that can cause overfitting. One of
the solutions to overcome overfitting is to increase the number of data set samples that is used for
training compared to features. Another solution is to manually decrease the number of features,
but that might result in removing useful information. Another solution is to perform model
selection by using cross-validation.
References:
overfitting
https://en.oxforddictionaries.com/definition/overfitting
Preventing "Overfitting" of Cross-Validation Data
https://ai.stanford.edu/~ang/papers/cv-final.pdf
The Problem of Overfitting
https://www.youtube.com/watch?v=OSd30QGMl88

© Copyright IBM Corp. 2018, 2022 1-65


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Model evaluation (cont.)


• Underfitting occurs when a machine learning model cannot fit the training data or generalize
to new data.
ƒ Reason: The model is using a simple estimator.
ƒ Solution: Add More features or use different estimator

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-60. Model evaluation (cont.)

Underfitting (also referred to as “high bias”) occurs when a machine learning model cannot fit the
training data or generalize to new data.
A possible reason might be that the model is using a simple estimator. For example, you might be
using a linear estimator, but what you actually need is a quadratic or higher degree polynomial
estimator to develop your model like in “Right fit” graph.
Another reason might be that you are not using enough features, so your estimator fails to capture
the structure of the data. A possible solution would be to add more features and try a different
estimator.
There are other methods that are used to help resolve the overfitting and underfitting of your
model such as regularization, but these methods are beyond the scope of this course.
References:
overfitting
https://en.oxforddictionaries.com/definition/overfitting
The Problem of Overfitting
https://www.youtube.com/watch?v=OSd30QGMl88

© Copyright IBM Corp. 2018, 2022 1-66


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Model evaluation (cont.)


• Cross-validation (CV) is a process to evaluate a model by dividing the data set once or several
times in training and testing.
• Hold-out method: Randomly splits the data set into a training set and test set.
• K-fold cross validation: Splits data into K subsamples where each subsample gets a chance
to be the validation set, and K-1 is the training set.
• Leave one out cross validation (LOO-CV): Similar to K-fold except that one subsample that
contains one data point is held out, and the rest of data is used for training.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-61. Model evaluation (cont.)

It is common practice when applying a (supervised) machine learning task is to hold out part of
the available data as a test set. There are different methods to achieve that task:
• Cross-validation (CV) is a process to evaluate a machine learning model by splitting a data set
once or several times to train and test the model. The data set can be split into a training set to
train the model and a validation set to pre-test the model. Select the model that has least
error. Finally, there is a test set to evaluate the model. Thus, the data set can be split as 60% -
20% - 20% for training, validation, and testing sets.
One criticism of this process is that splitting the data set into three parts reduces the number
of samples that can be used for training the model.
• The hold-out method partitions the data set into a majority set for training and minority set for
testing. The split of the training set to test set is 80% - 20% or 70% - 30%, with no fixed rule.
• K-fold cross validation randomly partitions data into K equal sized subsamples. For each
iteration, one subsample is kept as validation set and the rest of the subsamples (K-1) are the
training set. The iterations are repeated K times, where each subsample has one chance to be
the validation set. The K results can then be averaged to produce a single model. The biggest
advantage of K-fold is that all data is changed to be used for both training and validation.
There is no strict rule for the number K, but it is commonly K=5 or K=10, which are 5-fold
cross-validation or 10-fold cross-validation. For each subsample, you maintain approximately
the same percentage of data of each target class as in the complete set, which is known as the
Stratified K-fold method.
• Leave one out CV (LOO-CV) is similar to K-fold, but in this case each one sample data point is
held out as a validation set, and the rest of data set is the training set. Comparing LOO-CV and
K-fold, K-fold is faster and requires less computation, but in terms of accuracy, LOO-CV often
has a high variance as an estimator.

© Copyright IBM Corp. 2018, 2022 1-67


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty
References:
A survey of cross-validation procedures for model selection
https://projecteuclid.org/download/pdfview_1/euclid.ssu/1268143839
Cross-validation: evaluating estimator performance
http://scikit-learn.org/stable/modules/cross_validation.html
Cross Validation
https://www.cs.cmu.edu/~schneide/tut5/node42.html

© Copyright IBM Corp. 2018, 2022 1-68


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Unit summary • Explain what is machine learning


• Describe what is meant by statistical model and algorithm
• Describe machine learning types and approaches (Supervised,
Unsupervised and Reinforcement)
• List different machine learning algorithms
• Explain what neural networks and deep learning are, and why they
are important in today’s AI field
• Explain how to evaluate your machine learning model

© Copyright IBM Corporation 2018, 2022

Figure 1-62. Unit summary

© Copyright IBM Corp. 2018, 2022 1-69


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Review questions
1. True or False: In logistic regression, the target output is a continuous value.
2. True or False: Autonomous cars are one of many applications of deep learning.
3. True or False. A perceptron is a single neuron model that is the originator for neural
networks.
4. Assume that you want to develop a learning algorithm to address the following problem: You
want to examine individual customer accounts and determine whether they have been hacked
or compromised. This should be treated as a supervised __________.
a. Classification
b. Regression

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-63. Review questions

© Copyright IBM Corp. 2018, 2022 1-70


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Review answers
1. True or False: In a logistic regression, the target output is a continuous value.
The answer is False.
2. True or False: Autonomous cars are one of many applications of deep learning.
The answer is True.
3. True or False. A perceptron is a single neuron model that is the originator for neural
networks.
The answer is True.
4. Assume that you want to develop a learning algorithm to address the following problem: You
want to examine individual customer accounts and determine whether they have been hacked
or compromised. This should be treated as a supervised ___________.
a. Classification
b. Regression
The answer is a.

Introduction to machine learning © Copyright IBM Corporation 2018, 2022

Figure 1-64. Review answers

© Copyright IBM Corp. 2018, 2022 1-71


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Exercise: Applying machine learning algorithms

Figure 1-65. Exercise: Applying machine learning algorithms

© Copyright IBM Corp. 2018, 2022 1-72


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 1. Introduction to machine learning

Uempty

Exercise • This exercise provides the foundational concepts that you need to
understand to apply four popular machine learning algorithms:
objectives ƒ K-means clustering
ƒ Naïve Bayes classifier
ƒ Linear regression
ƒ Decision tree
• After completing this exercise, you should be able to:
ƒ Determine the centroids of a data set with the K-means clustering
algorithm.
ƒ Predict the class of an object with the Naïve Bayes classifier.
ƒ Apply the linear regression algorithm to solve supervised learning
problems.
ƒ Construct a decision tree to predict outcomes.

© Copyright IBM Corporation 2018, 2022

Figure 1-66. Exercise objectives

After completing this exercise, you should be able to:


• Determine the centroids of a data set with the K-means clustering algorithm.
• Predict the class of an object with the Naïve Bayes classifier.
• Apply the linear regression algorithm to solve supervised learning problems.
• Construct a decision tree to predict outcomes.

© Copyright IBM Corp. 2018, 2022 1-73


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Unit 2. Introduction to IBM Watson


Estimated time
01:00

Overview
This unit provides an overview of key IBM Watson services, their purpose, how they work, and it
helps you get started with Watson services on IBM Cloud.

© Copyright IBM Corp. 2018, 2022 2-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Unit objectives • Explain what IBM Watson is


• List the Watson services
• Explain the capabilities and applications of each Watson service
• Describe the purpose of training the various Watson services to
adapt them to a domain
• Provide an overview about building AI solutions with Watson
services

© Copyright IBM Corporation 2018, 2022

Figure 2-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 2-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Topics • IBM Watson overview


• IBM Watson services on IBM Cloud
• Build with Watson

© Copyright IBM Corporation 2018, 2022

Figure 2-2. Topics

© Copyright IBM Corp. 2018, 2022 2-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty
2.1. IBM Watson overview

© Copyright IBM Corp. 2018, 2022 2-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

IBM Watson
overview

Figure 2-3. IBM Watson overview

This section provides a high-level overview of IBM Watson

© Copyright IBM Corp. 2018, 2022 2-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

IBM Watson
• IBM Watson is the artificial intelligence (AI) offering from IBM.
• IBM Watson has the following capabilities:
ƒ Understands all forms of data.
ƒ Interacts naturally with people.
ƒ Learns and reasons at scale.
• You do not need to know the details of every associated AI subfield.
• You must have a high-level understanding of each subfield.
• You must know how to apply the correct AI technology to the problem by using AI application
programming interfaces (APIs) or a ready-to-use AI framework.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-4. IBM Watson

IBM Watson is an AI system that enables a new partnership between people and computers. It is
the AI offering from IBM. Watson combines five core capabilities:
• Interacts with people more naturally based on the person’s preference.
• Quickly imports key industry materials by partnering with experts to scale and elevate
expertise.
• Enables new products and services to sense, reason, and learn about users and the world
around them.
• Uses data to improve business processes and forecasting, which increases operational
effectiveness.
• Enhances exploration and discovery, which uncovers unique patterns, opportunities, and
actionable hypotheses.
IBM Watson includes AI technologies. Those technologies are complex, and to understand them
fully requires many years of study. However, to add AI capabilities to your applications, you do not
need to know the details that are associated with each AI subfield. You must have a high-level
understanding of each subfield, for example, natural language processing (NLP) and machine
learning. Then, you must know how to apply the correct AI technology to a problem by using AI
APIs or a ready-to-use AI framework.

© Copyright IBM Corp. 2018, 2022 2-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

IBM Watson history


• Named after the first CEO of IBM, Thomas J. Watson.
• Originally designed as a QA system architecture named DeepQA.
• In 2011, the Watson computer system competed on Jeopardy! against the two most
successful champions: Brad Rutter and Ken Jennings. Watson won the first place prize of $1
million.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-5. IBM Watson history

Watson was named after the first CEO of IBM, Mr Thomas J. Watson.
In 2011, the Watson computer system competed on Jeopardy! a US nationally televised quiz
show, against former winners Brad Rutter and Ken Jennings. Watson won the first place prize of
$1 million. Watson had access to 200 million pages of structured and unstructured content that
filled 4 TB of disk storage, including the full text of Wikipedia.
The original Watson system that won Jeopardy! was based on a QuestionAnswering (QA) system
architecture, which was developed for Watson to play the game and which is known as the
DeepQA architecture. This system was specifically developer to answer trivia question.
DeepQA was a software architecture for deep content analysis and evidence-based reasoning. It
uses advanced natural language processing (NLP), information retrieval, reasoning, and machine
learning. In summary, DeepQA generates and scores many hypotheses by using an extensible
collection of natural language processing, machine learning, and reasoning algorithms, which
gather and weigh evidence over both unstructured and structured content to determine the
answer with the best confidence. The answer with the strongest confidence is Watson’s final
answer. DeepQA was trained in the open domain Wikipedia which is very appropriate to answer
trivia questions.
The original DeepQA architecture, designed to play the Jeopardy! game, evolved trough several
iterations to the Watson services and offerings available today. And it will continue to evolve
through the years with the major advancements in AI.

© Copyright IBM Corp. 2018, 2022 2-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

IBM Watson relies on data, information, and expertise


• Available as a set of open application programming interfaces (APIs), software as a service
(SaaS) tools and industry solutions.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-6. IBM Watson relies on data, information, and expertise

Data, information, and expertise create the foundation for working with Watson. The figure shows
examples of data and information that Watson can analyze and learn from and derive new insights
that were never discovered before.

© Copyright IBM Corp. 2018, 2022 2-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

IBM Watson services offerings


• IBM Watson is available as the following offerings:
ƒ A set of services on IBM Cloud
ƒ Software as a Service (SaaS)
ƒ Set of industry solutions
ƒ Other solutions
• The focus of this unit is the IBM Watson services on IBM Cloud.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-7. IBM Watson services offerings

IBM Watson is available as a set of services on IBM Cloud, SaaS cloud offerings, and a set of
industry solutions. Besides the core offerings, a large set of resources and documentation are
available for application developers.
The focus of this unit (and this course) is on IBM Watson services on IBM Cloud only.

© Copyright IBM Corp. 2018, 2022 2-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty
2.2. IBM Watson services on IBM Cloud

© Copyright IBM Corp. 2018, 2022 2-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

IBM Watson
services on IBM
Cloud

Figure 2-8. IBM Watson services on IBM Cloud

This section provides an overview of the Watson services and tools available on IBM Cloud.

© Copyright IBM Corp. 2018, 2022 2-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Watson services on IBM Cloud - Summary

AI Assistant Watson Assistant

Data Watson Studio Machine Learning Watson Knowledge Catalog Watson OpenScale

Watson Discovery Natural Language Understanding Knowledge Studio


Knowledge

Speech to Text Text to Speech


Speech

Language Language Translator Natural Language Understanding

Empathy Natural Language Understanding

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-9. Watson services on IBM Cloud - Summary

The figure shows the Watson services on IBM Cloud at the time of writing. These services continue
to be enhanced, some will be deprecated and replaced, and new services will be introduced in the
future.
The following services are available as REST APIs and software as a solution (SaaS) tools that
developers can use to build AI solutions or add AI features to their applications. For more
information, see https://www.ibm.com/watson/products-services/.
• AI Assistant (Chatbot): Integrate diverse conversation technologies into your application by
using Watson Assistant to build a chatbot by using intents, entities, actions and dialog trees. It
uses NLP and pattern recognition techniques.
• Data: Collect, organize, and analyze your data, and then achieve trust, scale, and automation
across your full AI lifecycle:
▪ Watson Studio: A collaborative environment with AI tools that a team can use to collect
and prepare training data, and to design, train, and deploy machine learning models.
▪ Watson Machine Learning: Enables users to perform two fundamental operations of
machine learning: training and scoring.
▪ Watson Knowledge Catalog: A machine learning data catalog that enables you to access,
curate, categorize, and share data, knowledge assets, and their relationships, wherever
they are.
▪ Watson OpenScale: Operate and automate AI at scale by infusing it with trust and
transparency, explaining its outcomes, and eliminating harmful bias.

© Copyright IBM Corp. 2018, 2022 2-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty
• Knowledge: Get insights through accelerated data optimization capabilities:
▪ Discovery: Unlock hidden value in data to find answers, monitor trends, and surface
patterns.
▪ Watson Natural Language Understanding: NLP for advanced text analysis.
▪ Knowledge Studio: Teach Watson to discover meaningful insights in unstructured text.
• Speech: Converts text and speech with the ability to customize models:
▪ Speech to Text: Easily converts audio and voice into written text.
▪ Text to Speech: Converts written text into natural-sounding audio.
• Language: Analyzes text and extracts metadata from unstructured content:
▪ Language Translator: Translates text from one language to another.
▪ Natural Language Understanding: Uses deep learning to extract data and insights from text
such as entities and keywords. Includes multi-label text classification capabilities. This
feature includes extended language support and training data customizations to better
handle your text classification needs. By using NLU, you can easily expand to several NLP
use cases, and create rich and sophisticated applications for your business and customers.
• Empathy: Understands tone, personality, and emotional state:
▪ Natural Language Understanding: Extract sentiment and emotions from text. Tone analysis
is done by using a pre-built classifications model, which provides an easy way to detect
language tones in written text. It detects seven tones: sad, frustrated, satisfied, excited,
polite, impolite, and sympathetic. People show various tones, such as joy, sadness, anger,
and agreeableness, in daily communications. Such tones can impact the effectiveness of
communication in different contexts.
Reference:
IBM Watson products
https://www.ibm.com/watson/products-services/

© Copyright IBM Corp. 2018, 2022 2-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Watson Assistant
• Adds a natural language interface to your application to automate interactions with your users.
• Build the conversation flow and train the service by using an easy-to-use web interface.
• Integrate Watson Assistant with other Watson services to enrich the chatbot interaction
experience.
• Example applications: Virtual agents and chatbots.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-10. Watson Assistant

Watson Assistant
IBM Watson Assistant is a cognitive bot that you can customize for your business needs and
deploy across multiple channels to bring help to your customers where and when they need it.
You can add a natural language interface to your application to automate interactions with your
users.
Example applications include virtual agents and chat bots that can integrate and communicate on
any channel or device, including mobile devices, messaging platforms, and robots.
Train the Watson Assistant service by using an easy-to-use web interface so that you can quickly
build natural conversation flows between your apps and users and deploy scalable and
cost-effective solutions.

© Copyright IBM Corp. 2018, 2022 2-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Watson Discovery
• Adds cognitive search and content analytics to applications to identify patterns, trends, and
insights.
• Unlocks actionable insights into unstructured data.
• Unifies structured and unstructured data.
• Uses simple query language to eliminate the need for manual filtering of results.
• Includes the Discovery API and Discovery tooling.
• Example application: Find answers to FAQs

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-11. Watson Discovery

Watson Discovery
Add a cognitive search and content analytics engine to applications to identify patterns, trends,
and actionable insights that drive better decision-making. Rapidly build cognitive, cloud-based
exploration applications that unlock actionable insights that are hidden in unstructured data.
Securely unify structured and unstructured data with pre-enriched content and use a simplified
query language to eliminate the need for manual filtering of results.
With Discovery, you can prepare your unstructured data, create a query that will pinpoint the
information you need, and then integrate those insights into your new application or existing
solution.
The Discovery services includes:
• Discovery API: The Discovery service supports a number of SDKs to simplify the development
of applications. The SDKs are available for many popular programming languages and
platforms, including Node.js, Java, and Python.
• Discovery tooling: The Discovery service includes a complete set of online tools - the
Discovery tooling - to help you quickly setup an instance of the service and populate it with
data. The Discovery service tooling has been designed to save time by eliminating the need to
use APIs to configure and populate your service.
With Discovery you can build applications that extract the correct answers to FAQs by enriching
and searching data collections.

© Copyright IBM Corp. 2018, 2022 2-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Natural Language Understanding


• Analyze semantic features of text input, including the following items:
ƒ Concepts, Entities, Keywords, Categories, Sentiment, Emotion, Relations, Semantic roles
• Categorize content.
• Develop custom annotation models to identify domain-specific entities and relations in
unstructured text by using Knowledge Studio.
• Example applications: Categorize news articles and blog posts and sort them based on general
concepts, keywords, and entities.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-12. Natural Language Understanding

Natural Language Understanding


Analyze text to extract metadata from content such as concepts, entities, keywords, categories,
sentiment, emotion, relations, semantic roles.
Categorize your content by using a five-level classification hierarchy. View the complete list of
categories at
https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understan
ding-categories-hierarchy
Custom annotation models are developed by using Watson Knowledge Studio to identify industry-
and domain-specific entities and relations in unstructured text.
Example applications: Categorize news articles and blog posts and sort them based on general
concepts, keywords, and entities.

© Copyright IBM Corp. 2018, 2022 2-16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Speech to Text
• Converts human voice into the corresponding text.
• Uses machine intelligence to combine information about grammar and language structure with
knowledge of the composition of the audio signal to generate an accurate transcription.
• Provides APIs that you can use to add speech transcription capabilities to your applications.
• The languages that are currently supported are: Arabic (Modern Standard), Brazilian
Portuguese, Chinese (Mandarin), Czech, Dutch, English (Australian, United Kingdom, and
United States), French (French and Canadian), German, Hindi (Indian), Italian, Japanese,
Korean, Spanish
• Example applications:
ƒ Voice control of applications, embedded devices, and vehicle accessories
ƒ Transcribing meetings and conference calls
ƒ Dictating email messages and notes

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-13. Speech to Text

Speech to Text
The Speech to Text service converts the human voice into the corresponding text. Use this service
to convert audio and voice into text for quick understanding of content. It can be used anywhere
there is a need to bridge the gap between the spoken word and their written form, including voice
control of embedded systems, transcription of meetings and conference calls, and dictation of
email and notes. This easy-to-use service uses machine intelligence to combine information
about grammar and language structure with knowledge of the composition of the audio signal to
generate an accurate transcription.
The following languages are currently supported: Arabic (Modern Standard), Brazilian Portuguese,
Chinese (Mandarin), Czech, Dutch, English (Australian, United Kingdom, and United States),
French (French and Canadian), German, Hindi (Indian), Italian, Japanese, Korean, Spanish
(Argentinian, Castilian, Chilean, Colombian, Mexican, and Peruvian).

Note

The list of languages is constantly updated. For the most current list of languages that are
supported, see Language support at
https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-about#about-languages

© Copyright IBM Corp. 2018, 2022 2-17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty
The Speech to Text service can take an audio voice file as input and convert the audio into written
text.
This service can be used in practical applications such as these:
• Transcribe calls in a contact center to identify what is being discussed, when to escalate calls,
and to understand content from multiple speakers.
• Transcribe a technical explanation provided by a subject matter expert to help to create
documentation.
• Transcribe speech from a movie and create subtitles or captions.
• Transcribe voice mail messages to obtain a written log of messages left, for example, by
clients or patients.
• Create voice control applications, for example an automated home control system that is
based on your speech. Functions can include switching the light on and off, controlling
electronic devices, or even opening the front door remotely.

© Copyright IBM Corp. 2018, 2022 2-18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Text to Speech
• Converts written text into natural sounding audio in various languages and voices.
• The currently available languages are Arabic, Brazilian Portuguese, Chinese (Mandarin), Czech,
Dutch, English (Australian, United Kingdom, and United States dialects), French, German,
Italian, Japanese, Korean, Spanish (Castilian, Latin American, and North American dialects),
Swedish.
• Example applications: Voice-driven and screenless applications, where audio is the preferred
method of output:
ƒ Interfaces for the disabled, such as assistance tools for the vision-impaired
ƒ Reading text and email messages aloud to drivers
ƒ Video-script narration and video voice over
ƒ Reading-based educational tools
ƒ Home-automation solutions

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-14. Text to Speech

Text to Speech
Use the Watson Text to Speech API to convert written text into natural sounding audio in various
languages and voices. The Text to Speech service processes text and natural language to
generate synthesized audio output with the appropriate cadence and intonation.
The service supports voices in the following languages: Arabic, Brazilian Portuguese, Chinese
(Mandarin), Czech, Dutch, English (Australian, United Kingdom, and United States dialects),
French, German, Italian, Japanese, Korean, Spanish (Castilian, Latin American, and North
American dialects), Swedish. The service offers at least one male or female voice, sometimes
both, for each language.

Note

This list is updated overtime. For the most current list, see Language support at
https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-about#about-languages

The service is appropriate for voice-driven and screenless applications, where audio is the
preferred method of output:
• Interfaces for the disabled, such as assistance tools for the vision-impaired
• Reading text and email messages aloud to drivers
• Video-script narration and video voice over
• Reading-based educational tools
• Home-automation solutions

© Copyright IBM Corp. 2018, 2022 2-19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty
This service can be used in practical applications such as these:
• Create audio narration from a written script for a variety of applications, such as online
tutorials for an e-learning course, audio books, and so on.
• Provide callers with information, such as company location, store hours, and account
information that is extracted from a database or organization’s documentation and converted
to audible speech.
• Develop interactive educational material for children.
• Communicate directions, hands-free.

© Copyright IBM Corp. 2018, 2022 2-20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Language Translator
• Identifies the language of text and translates it into different languages programmatically.
• High-quality, domain-specific text translation.
• The following domains and languages are supported:
ƒ The News domain to translate English to and from French, Spanish, Portuguese, or Arabic.
ƒ The Conversational domain to translate English to and from Spanish or Portuguese.
ƒ The Patent domain to translate Spanish, Portuguese, Japanese, or Korean to English.
• Extend provided models to learn custom terms and phrases.
• Example application: Enable a help desk representative to assist international customers
through chat.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-15. Language Translator

Language Translator
This service provides high-quality and domain-specific text translation from one language to
another. It is one of the few offerings that focuses on domain-specific Statistical Machine
Translation.
The following domains and languages are supported:
• The News domain to translate English to and from French, Spanish, Portuguese, or Arabic.
• The Conversational domain to translate English to and from Spanish or Portuguese.
• The Patent domain to translate Spanish, Portuguese, Japanese, or Korean to English
You can create your own custom translation model. Most of the provided translation models in
Language Translator can be extended to learn custom terms and phrases or a general style that is
derived from your translation data.
Example application: Enable a help desk representative to assist international customers through
chat.

© Copyright IBM Corp. 2018, 2022 2-21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Watson Studio
• Collaborative environment with AI tools to collect and prepare training data, and to design,
train, and deploy machine learning models.
• It is a SaaS solution that is delivered on IBM Cloud.
• Watson Studio AI tools support popular frameworks, including: TensorFlow, Caffe, PyTorch,
and Keras.
• The architecture of Watson Studio is centered around the project.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-16. Watson Studio

Watson Studio
IBM Watson Studio is a collaborative environment with AI tools that a team can use to collect and
prepare training data, and to design, train, and deploy machine learning models.
It is a SaaS solution that is delivered on IBM Cloud.
Watson Studio provides a suite of tools for data scientists, application developers, and subject
matter experts (SMEs) to work collaboratively and easily with data. They can then use that data to
build, train, and deploy models at scale. These tools are preconfigured so that builders do not
have to spend time installing, setting up, and maintaining them. The built-in catalog function
enables knowledge sharing and retention. Watson Studio can infuse AI into your business.
It enables you to analyze data by using RStudio, Jupyter, and Python in a configured and
collaborative environment that includes added value, such as managed Spark and IBM Watson
Machine Learning.
The architecture of Watson Studio is centered around the project. A project is where you organize
your resources and work with data.

© Copyright IBM Corp. 2018, 2022 2-22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty
You can have these types of resources in a project:
• Collaborators are the people on the team who work with the data. Data scientist tasks include
analyzing data and building models. Data engineer tasks include preparing and integrating
data.
• Data assets point to your data that is either in uploaded files or accessed through connections
to data sources.
• Operational assets are the objects you create, such as scripts and models, to run code on data.
• Tools are the software you use to derive insights from data. These tools are included with the
Watson Studio service:
▪ Data Refinery: Prepare and visualize data.
▪ Jupyter notebook editor: Code Jupyter notebooks.
▪ RStudio: Code Jupyter notebooks in R and R Shiny apps.
▪ SPSS Modeler: Automate the flow of data through a model with SPSS algorithms.
▪ Decision Optimization model builder: Optimize solving business problem scenarios.
▪ Other project tools require additional services. See the lists of supplemental and related
services.
You can think of Watson Studio AI tools in these categories:
• Natural language classification
• Machine learning
• Deep learning
Reference:
Watson Studio on Cloud Pak for Data as a Service
https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/wsl.html

© Copyright IBM Corp. 2018, 2022 2-23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Watson Machine Learning


• Machine Learning is a service on IBM Cloud with features for training and deploying machine
learning models and neural networks. It provides:
ƒ Interfaces for building, training, and deploying models: Python client library external link, Command
line interface, REST API external link.
ƒ Deployment infrastructure for hosting your trained models.
ƒ Hyperparameter optimization for training complex neural networks.
ƒ Distributed deep learning for distributing training runs across multiple servers.
ƒ GPUs for faster training.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-17. Watson Machine Learning

IBM Watson Machine Learning is a full-service IBM Cloud offering that makes it easy for data
scientists and developers to work together to integrate predictive analytics with their
applications.
The Watson Machine Learning service enables your organization to use the models in your
end-to-end solutions without the impact of licensing, installation, and configuration that is
required by the same products when they are installed on-premises. You can use machine
learning and deep learning models in production. Use an automated and collaborative workflow to
grow intelligent business applications easily and with more confidence.
By using Watson Machine Learning, you can build sophisticated analytical models, trained with
your own data, that you can deploy for use in applications.
Machine Learning is a service on IBM Cloud with features for training and deploying machine
learning models and neural networks:
• Interfaces for building, training, and deploying models: Python client library external link,
Command line interface, REST API external link.
• Deployment infrastructure for hosting your trained models
After you create, train, and evaluate a model, you can deploy it. When you deploy a model, you
save it to the model repository that is associated with your Watson Machine Learning service.
Then, you can use your deployed model to score data and build an application.
• Hyperparameter optimization (HPO) for training complex neural networks
You can run your experiments with HPO to easily find the best quality model. Hyperparameter
Optimization is a mechanism for automatically exploring a search space of potential
hyperparameters, building a series of models and comparing the models by using metrics of
interest. To use HPO you must specify ranges of values to explore for each hyperparameter.

© Copyright IBM Corp. 2018, 2022 2-24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty
• Distributed deep learning for distributing training runs across multiple servers
Deep learning models training can be significantly accelerated with distributed computing on
GPUs.
• GPUs for faster training
IBM Watson Machine Learning deep learning simplifies the process to train models in parallel
with an on-demand graphics processing units (GPU) compute cluster that you can scale to
your specific needs.
For an overview of Watson Machine Learning, see: https://youtu.be/5kMDIBpxi_k

© Copyright IBM Corp. 2018, 2022 2-25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Knowledge Studio
• Enables developers and domain experts to collaborate and create a machine learning model
that understands the linguistic nuances, meaning, and relationships specific to an industry or
domain.
• Provides easy-to-use tools for annotating unstructured domain literature.
• The annotations are used to create a custom machine learning model that understands the
language of the domain.
• The model can be deployed directly to Watson Natural Language Understanding and Watson
Discovery.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-18. Knowledge Studio

IBM Watson Knowledge Studio


IBM Watson Knowledge Studio enables developers and domain experts to collaborate and create
a machine learning model that understands the linguistic nuances, meaning, and relationships
specific to an industry or domain.
Provides easy-to-use tools for annotating unstructured domain literature and uses those
annotations to create a custom machine-learning model that understands the language of the
domain.
These annotators can identify mentions and relationships in unstructured data and be easily
administered throughout their lifecycle by using one common tool.
Annotator components can be deployed directly to Natural Language Understanding, and
Discovery.
The diagram illustrates how it works:
1. Based on a set of domain-specific source documents, the team creates a type system that
defines entity types and relation types for the information of interest to the application that
will use the model.
2. A group of two or more human annotators annotates a small set of source documents to label
words that represent entity types, to identify relation types where the text identifies
relationships between entity mentions, and to define coreferences, which identify different
mentions that refer to the same thing, that is, the same entity. Any inconsistencies in
annotation are resolved, and one set of optimally annotated documents is built, which forms
the ground truth.
3. Watson Knowledge Studio uses the ground truth to train a model.

© Copyright IBM Corp. 2018, 2022 2-26


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Watson OpenScale
• Tracks and measures outcomes from your
AI models no matter where your models
were built or are running.
• Helps ensure that AI models are free from
bias, remain fair, can be easily explained
and understood by business users, and are
auditable in business transactions.
• Detects and helps correct the drift in
accuracy when an AI model is in
production.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-19. Watson OpenScale

IBM Watson OpenScale tracks and measures outcomes from your AI models, and helps ensure
that they remain fair, explainable, and compliant no matter where your models were built or are
running. Watson OpenScale also detects and helps correct the drift in accuracy when an AI model
is in production.
Enterprises use model evaluation to automate and put into service AI lifecycle in business
applications. This approach ensures that AI models are free from bias, can be easily explained
and understood by business users, and are auditable in business transactions. Model evaluation
supports AI models built and run with the tools and model serve frameworks of your choice.
Reference:
Validating and monitoring AI models with Watson OpenScale
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/getting-started.html?context=cpd
aas&audience=wdp

© Copyright IBM Corp. 2018, 2022 2-27


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty
2.3. Build with Watson

© Copyright IBM Corp. 2018, 2022 2-28


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Build with Watson

Figure 2-20. Build with Watson

This section provides the initial steps to get started using the Watson APIs. It also lists the key
resources available to developers.

© Copyright IBM Corp. 2018, 2022 2-29


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Building AI solutions with IBM Watson services on IBM Cloud

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-21. Building AI solutions with IBM Watson services on IBM Cloud

Watson services on IBM Cloud provide a cloud-hosted marketplace where application providers
of all sizes and industries can tap into resources for developing applications that are powered by
Watson services. Developers can combine the Watson services (and other services that are
available in IBM Cloud) with additional logic to build applications with AI capabilities.
The goal of Watson services on the IBM Cloud is to provide flexible platform for building AI
applications in industry domains. The microservices architecture enables developers to envision a
broad range of potential applications by mixing and matching services.
The available resources include developer toolkits, educational materials, and access to Watson
APIs and SaaS tools. This approach makes IBM Watson technology available as a development
platform in the cloud to enable a worldwide community of software application providers to build
a new generation of applications that is infused with Watson AI capabilities.

© Copyright IBM Corp. 2018, 2022 2-30


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Watson services and domain adaptation


• AI systems must be trained to understand new domains and perform new tasks.
• Built-in models included in Watson services are generic or geared towards popular
applications of the service.
ƒ The goal is to enable the initial use of the service with no training but the accuracy for a particular
application might not be satisfactory.
• Services must be trained to improve their performance for specific application.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-22. Watson services and domain adaptation

One key element of AI systems is the capability to learn and adapt overtime. Rather than being
explicitly programmed, AI systems learn from their interactions with their users and from their
experiences with their environment. Machine learning gives computers the ability to learn and act
without being explicitly programmed. This means that the model gets better over time by learning
from its mistakes and new experiences (being exposed to new data). When developing machine
learning models, the models are built from a fixed source, for example, open domain Wikipedia,
and they are deployed to similar or different domains, for example the Travel domain. To improve
accuracy, the new domain data must be used to train the model. This task is known as domain
adaptation.
Like humans, AI systems must be trained to understand new domains and perform new tasks. For
example, understanding medical records to identify medical conditions and associated
prescriptions requires deep knowledge of drugs and diseases. In order to be able to perform
these tasks, humans go to college, get a medical degree and, after many years of training and
study, become doctors. Likewise, AI systems must be trained to become experts in specific
domains. Training is performed by subject matter experts (SMEs) providing human supervision
and domain-specific knowledge bases representing entities and relations of interest for the new
domain. A similar process must be followed to apply Watson technology to specific domains.
Domain adaptation consists of the necessary activities to adapt an open-domain system to a
specific domain (a closed-domain).
Information extraction analytics that are provided by Watson APIs are open domain, which means
that they can recognize named entities that belong to basic types, such as company, person, and
location, but they cannot recognize more specific distinctions, such as names of banks, insurance
companies, and their products.
To become an SME in a specific industry or domain, some Watson services must be trained.

© Copyright IBM Corp. 2018, 2022 2-31


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Watson services and domain adaptation (cont.)

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-23. Watson services and domain adaptation (cont.)

The following services can be trained by developers and domain experts:


• Watson Assistant: This service must be trained to recognize what the user is saying and
respond accordingly.
• Discovery: The relevance of natural language query results can be improved in the Discovery
service with training. Relevancy training teaches the service what results should be surfaced
higher than others so that your users can get the correct answer to their question faster. You
also can use IBM Watson Knowledge Studio to train a custom model and deploy it to the
Discovery service.
• Language Translator service: This service can be trained over time to provide better accuracy
when running translations. To train, the service must learn from previous translations. For
example, Language Translator can be trained to reduce the error in translating financial news
across languages. Another example is that you are creating a translator for customer support
and you have company-specific terms that you want handled in a certain way in conversations.
A third example is that you are creating a way for your engineers in one country to look up
patent data in another language, and you often file patents on a specific technology. You can
use your own data to create a custom dictionary and a custom translation model in the
Language Translator service.
• Natural Language Understanding: This service is trained on an open domain by default. With
custom annotation models that are developed by using IBM Watson Knowledge Studio, you
can further customize the service to identify domain-specific entities and relations in your
content.

© Copyright IBM Corp. 2018, 2022 2-32


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty
• Speech to Text: This service can be customized for a particular domain by creating a language
model to provide the nuances in that domain in terms of vocabularies and word
pronunciations. By training the service, you can improve the accuracy of speech recognition
for domains such as medicine, law, information technology, and others.
• Text to Speech: This service provides a customization interface so that you can create a
dictionary of words and their translations for a specific language. This dictionary of words and
their translations is referred to as a custom voice model.
• Machine Learning. This service includes features for training and deploying machine learning
models and neural networks. With Machine Learning, you can build, train, deploy, and manage
machine learning and deep learning models.
• Watson OpenScale. This service tracks and measures outcomes from your AI models, and
helps ensure they remain fair, explainable, and compliant no matter where your models were
built or are running. Watson OpenScale also detects and helps correct the drift in accuracy
when an AI model is in production.
Knowledge Studio: Knowledge Studio is used as a tool to train other services. This service is used
to train Watson with the language of your domain by using custom machine learning models that
identify entities and relationships that are unique to your industry in unstructured text. You can
deploy a Watson Studio model to a Natural Language Understanding service or a Discovery service
References:
Deploying models with Watson Machine Learning
https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml-overview.html?context=
cpdaas&audience=wdp
Training and deploying machine learning models in notebooks
https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml-notebook_local.html?au
dience
Create a Training Run
https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml_dlaas_working_with_ne
w_models.html?audience=wdp
End-to-end example for running a deep learning training run
https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml_dlaas_e2e_example.ht
ml?audience=wdp
Validating and monitoring AI models with Watson OpenScale
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/getting-started.html?context=cpd
aas&audience=wdp
Formatting and uploading training data in Watson OpenScale
https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=openscale-formatting-uploading-t
raining-data

© Copyright IBM Corp. 2018, 2022 2-33


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Getting started with Watson services on IBM Cloud


You must complete these steps to use the Watson services on IBM Cloud:
1. Set up your IBM Cloud account.
2. Find and select the Watson service in the IBM Cloud catalog.
3. Create the service instance.
4. Get the service credentials to authenticate to your service from your application.
5. Start coding your application and calling the Watson APIs to infuse AI capabilities into your
app.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-24. Getting started with Watson services on IBM Cloud

To get started with Watson services on IBM Cloud, you must complete these steps before you can
use the service in your applications:
1. Set up your IBM Cloud account.
2. Find and select the Watson service that you need from the IBM Cloud catalog.
3. Create a service instance. IBM Cloud provides resources to your applications through a service
instance.
4. Get service credentials. You need the service credentials to authenticate to your service
instance from your application.
5. Start coding your application and calling the Watson APIs to infuse AI capabilities into your
app.

© Copyright IBM Corp. 2018, 2022 2-34


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Watson SDKs
• Enable developers to use Watson REST APIs in their favorite programming language.
• Developers should consider using the SDKs instead of calling the REST APIs directly.
• Watson SDKs supported by IBM:
ƒ Android SDK, Java SDK, Node.js SDK, Python SDK, Ruby SDK, Salesforce SDK, Swift SDK, .NET SDK,
OpenWhisk SDK, and Unity SDK
• Watson SDKs from the Watson community of developers:
ƒ Go SDK, PHP SDK, Ruby wrappers, Scala SDK

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-25. Watson SDKs

© Copyright IBM Corp. 2018, 2022 2-35


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Additional resources for developers


• For more information access these resources:
• Explore the complete list of Watson APIs: Watson Products and Services
• Get started on IBM Cloud : IBM Cloud essentials
• Access developer’s resources:
ƒ Getting started with Watson and IBM Cloud
ƒ Watson is for AI business
ƒ Documentation and API Reference
ƒ Watson SDKs
ƒ Building Cognitive Applications with IBM Watson Services
ƒ AI articles and tutorials
ƒ Watson webinars

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-26. Additional resources for developers

• Watson products and services: https://www.ibm.com/watson/products-services/


• Getting started with Watson and IBM Cloud:
https://cloud.ibm.com/docs/watson/getting-started-sdks.html#sdksm-cloud-essentials
• Watson is AI for business: https://cloud.ibm.com/developer/watson/dashboard
• Documentation and API Reference: https://cloud.ibm.com/developer/watson/documentation
• Watson SDKs:
https://cloud.ibm.com/docs/natural-language-understanding?topic=watson-using-sdks
• Building Cognitive Applications with IBM Watson Services:
http://www.redbooks.ibm.com/redbooks.nsf/pages/cognitiveapps?Open
• AI articles and tutorials: https://developer.ibm.com/technologies/artificial-intelligence/
• Watson webinars: https://www.ibm.com/watson/webinars/

© Copyright IBM Corp. 2018, 2022 2-36


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Unit summary • Explain what IBM Watson is


• List the Watson services
• Explain the capabilities and applications of each Watson service
• Describe the purpose of training the various Watson services to
adapt them to a domain
• Provide an overview about building AI solutions with Watson
services

© Copyright IBM Corporation 2018, 2022

Figure 2-27. Unit summary

© Copyright IBM Corp. 2018, 2022 2-37


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Review questions
1. Enables applications to use natural language to automatically respond to user questions:
a. Natural Language Understanding
b. Watson Assistant
c. Watson OpenScale
d. Discovery
e. Speech to Text.

2. Provides tools that SMEs can use to annotate unstructured domain literature and uses those
annotations to create a custom machine-learning model that understands the language of the
domain.
a. Watson Studio
b. Machine Learning
c. Knowledge Studio
d. Watson Health

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-28. Review questions

© Copyright IBM Corp. 2018, 2022 2-38


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Review questions (cont.)


3. True or False: Knowledge Studio can be used as a tool to train Natural Language
Understanding and Discovery.
4. The architecture of Watson Studio is centered around:
a. Notebooks
b. Projects
c. Collaborators
d. Models
e. Annotations.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-29. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 2-39


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Review questions (cont.)


5. Which Watson services can be used to categorize news articles and blog posts, and extract
sentiment and emotions from text?
a. Watson Assistant

b. Watson OpenScale

c. Knowledge Studio

d. Natural Language Understanding

e. Machine learning

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-30. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 2-40


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Review answers
1. Enables applications to use natural language to automatically respond to user questions:
a. Natural Language Understanding
b. Watson Assistant
c. Watson OpenScale
d. Discovery
e. Speech to Text

2. Provides tools that SMEs can use to annotate unstructured domain literature and uses those
annotations to create a custom machine-learning model that understands the language of the
domain.
a. Watson Studio
b. Machine Learning
c. Knowledge Studio
d. Watson Health

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-31. Review answers

© Copyright IBM Corp. 2018, 2022 2-41


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Review answers (cont.)


3. True or False: Knowledge Studio can be used as a tool to train Natural Language
Understanding and Discovery.

4. The architecture of Watson Studio is centered around:


a. Notebooks
b. Projects
c. Collaborators
d. Models
e. Annotations.

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-32. Review answers (cont.)

© Copyright IBM Corp. 2018, 2022 2-42


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Review answers (cont.)


5. Which Watson service can be used to categorize news articles and blog posts, and extract
sentiment and emotions from text?
a. Watson Assistant

b. Watson OpenScale

c. Knowledge Studio

d. Natural Language Understanding

e. Machine learning

Introduction to IBM Watson © Copyright IBM Corporation 2018, 2022

Figure 2-33. Review answers (cont.)

© Copyright IBM Corp. 2018, 2022 2-43


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Exercise: Exploring IBM Watson services

Figure 2-34. Exercise: Exploring IBM Watson services

© Copyright IBM Corp. 2018, 2022 2-44


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 2. Introduction to IBM Watson

Uempty

Exercise • This exercise introduces you to Watson REST APIs. You use
Postman and optionally cURL to submit requests to and receive
objectives responses from the following Watson services:
ƒ Natural Language Understanding
ƒ Language Translator
• After completing this exercise, you should be able to:
ƒ Create Watson service instances.
ƒ Copy credentials from a service instance.
ƒ Submit API calls with the appropriate parameters.
ƒ Analyze the response that is returned from the Watson service.
ƒ Use Watson API reference documentation.

© Copyright IBM Corporation 2018, 2022

Figure 2-35. Exercise objectives

After completing this exercise, you should be able to accomplish the following tasks:
• Create Watson service instances.
• Copy credentials from a service instance.
• Submit API calls with the appropriate parameters.
• Analyze the response that is returned from the Watson service.
• Use Watson API reference documentation.

© Copyright IBM Corp. 2018, 2022 2-45


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Unit 3. Introduction to IBM Watson


Studio
Estimated time
00:30

Overview
This unit provides a high level overview of IBM Watson Studio, its components, key applications
and the value added by the IBM offering.

© Copyright IBM Corp. 2018, 2022 3-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Unit objectives • Describe Watson Studio.


• Identify industry use cases.
• List Watson Studio offerings.
• Create Watson Studio projects.
• Describe Watson Studio and Spark environment.
• Describe Watson Studio and Cloud Object Storage.
• Explain Watson Studio high availability considerations.
• Prepare and analyze data.
• Use Jupyter notebooks.

© Copyright IBM Corporation 2018, 2022

Figure 3-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 3-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Topics • Watson Studio overview


• Watson Studio components
• Jupyter notebooks

© Copyright IBM Corporation 2018, 2022

Figure 3-2. Topics

© Copyright IBM Corp. 2018, 2022 3-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty
3.1. Watson Studio overview

© Copyright IBM Corp. 2018, 2022 3-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Watson Studio
overview

Figure 3-3. Watson Studio overview

© Copyright IBM Corp. 2018, 2022 3-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

What is Watson Studio?


• Watson Studio provides the environment and tools for you to work on data to solve your
business problems.
ƒ Analyze and visualize data, cleanse and shape data, ingest streaming data, and create and train
machine learning models.
• Collaborative platform:
ƒ Collaborators share data sets and computing resources
ƒ Simplified communication between different users and job roles
• Tools: Data Refinery, Jupyter notebooks, RStudio, SPSS Modeler flows, Decision Optimization.
• Integrated with:
ƒ Watson Knowledge Catalog
ƒ Watson Machine Learning
ƒ Cognos Dashboards

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-4. What is Watson Studio?

Watson Studio is a collaborative platform for working on data. The collaborative platform
enables the users, whether they are data scientists, data engineers, or application developers to
share resources and work together seamlessly within the platform.
Watson Studio contains some open-source components such as Python, Scala, R, and Jupyter
notebooks, and IBM added value components such as Watson Machine Learning, SPSS Modeler,
Decision Optimization, AutoAI, and more.
References
Watson Studio on Cloud Pak for Data as a Service
https://dataplatform.cloud.ibm.com/docs/content/wsj/landings/wsl.html

© Copyright IBM Corp. 2018, 2022 3-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Correct tool for the correct job

Data Engineer
OUTPUT INPUT Designs how data is organized
and ensures operability.
Deliver and Understand
Deploy Model. Problem and
Domain.
Data Scientist
Communicate Import Goes deep into the data to draw
Results. Data. hidden insights for the business.
Watson Studio

Create Explore and Business Analyst


and Build Understand Works with data to apply insights
Model. Data. to the business strategy.
Cognos Analytics

Transform:
Evaluate App Developer
Transform: Clean.
. Plugs into data and models and
Shape. writes code to build apps.
IBM Cloud
ANALYSIS

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-5. Correct tool for the correct job

Open-source tools give you a wide range of choices. The downside of having too many choices is
knowing the correct one to choose. Essentially, you want to pick the correct tool for the correct
job. Watson Studio is no exception.
Watson Studio is designed for a specific persona, but other personas can use it as it relates to
their jobs.
Look at the diagram on the slide. Starting from the top and going clockwise, you have the input,
analysis, and output phases. Within each phase are the objectives of that phase. Each objective
can overlap between various user personas.
Look at the list of personas on the right side: the data engineer, the data scientist, the business
analyst, and the app developer. Each persona has primary tools that help them do their job. For
example, the data scientist's main tool is Watson Studio.
Also, a team might include different personas. Whatever the case is, you must decide what tool is
correct for the job, regardless of the personas. The definitions of personas can vary between
different companies and evolve over time.

© Copyright IBM Corp. 2018, 2022 3-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty
In addition to the tailored interface of Watson Studio, collaboration ties the team and the
organization together by enabling them to share projects, code, and ideas. Imagine a data
engineer builds a new data source and shares that asset with the data scientist and the business
analyst. The business analyst immediately builds the reports and dashboards that they need. The
data scientist experiments with the data and builds a model that passes all the tests and can be
used with new applications. The team can immediately share that model with the application
developer, who deploys a new application by using the model. As this project progresses, the
team members update and share their statuses with the team, asking questions and sharing ideas
or requirements.
In this scenario, data and analytics development become a team effort and is no longer done in
silos. Additionally, because these assets can be published, other departments can reuse these
assets, making the entire organization more agile.

© Copyright IBM Corp. 2018, 2022 3-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Industry use cases

Retail Transportation
Shopping experience End-to-end customer experience
Loss & fraud prevention Operations planning & optimization
Task & workforce optimization Predictive maintenance
Pricing & assortment optimization Route and asset optimization
Banking Media and Entertainment
Optimize offers & cross-sell Audience & fan insight
Risk management Social media insight
Fraud and crime management Content demand forecasting
Financial performance Marketing & advertising optimization
Manufacturing Telco
Inventory optimization Subscriber analytics
Predictive maintenance IOT analytics
Health, safety, & environment Proactive marketing
Production planning and scheduling Network design

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-6. Industry use cases

Data science spans multiple industries, but you can see that data analysis that is applied to some
of these use cases is not entirely new. In fact, organizations have been doing these types of
activities for many years. The advantage that you have with Watson Studio is that you can easily
collaborate with other data scientists by using well-known tools that are widely used in the
industry.

© Copyright IBM Corp. 2018, 2022 3-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Watson Studio offerings


• Watson Studio on Cloud Pak for Data as a Service (CP4DaaS)
ƒ On public IBM Cloud.
ƒ https://dataplatform.cloud.ibm.com
• Watson Studio on Cloud Pak for Data (CP4D)
ƒ Run on your own cluster: your hardware and network.
ƒ Same tools and features.
• Watson Studio Desktop (local workstation):
ƒ Download and try on your desktop.

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-7. Watson Studio offerings

Watson Studio is available in the following offerings:


• Watson Studio on Cloud Pak for Data as a Service (CP4DaaS) on the public IBM Cloud. To use
it, you must have an IBM Cloud account and create an instance of the Watson Studio service.
• Watson Studio on Cloud Pak for Data (CP4D). This offering can be installed on a private cloud
or on-premises on the organization’s servers. It includes the same tools and features that are
available in Watson Studio on CP4DaaS.
• Watson Studio Desktop is the local version of the tool that you install on your local machine.
IBM Watson Studio Desktop is a desktop client tool for solving your business problems by
analyzing data with artificial intelligence. With Watson Studio Desktop, you can prepare data
and build models on your desktop with visual drag and drop tools.

Note

Exercises of this course use Watson Studio on CP4DaaS (on IBM Cloud).

© Copyright IBM Corp. 2018, 2022 3-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty
References
Watson Studio on CP4DaaS
https://dataplatform.cloud.ibm.com/docs/content/getting-started/overview-ws.html
Watson Studio on CP4D
https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=services-watson-studio
Comparison between Cloud Pak for Data as a Service and Cloud Pak for Data 4.0
https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/compare-cpd.html
Overview of Watson Studio Desktop
https://www.ibm.com/docs/en/wsd?topic=overview

© Copyright IBM Corp. 2018, 2022 3-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Watson Studio high availability (public cloud)


• Designed for 24x7 availability: Continuous availability and continuous delivery
• Backup and recovery:
ƒ Watson Studio is disaster resistant.
ƒ Notebooks in Watson Studio are stored in a three-way Cloudant cluster in multiple geographic zones.
ƒ Watson Studio provides integration with GitHub and an interface for downloading notebooks if the
customer wants to use their own backup.

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-8. Watson Studio high availability (public cloud)

Watson Studio is designed for 24x7 availability, that is, continuous delivery and availability.
Features and updates are rolled out without downtime. Notebooks in Watson Studio are stored in
a three-way Cloudant cluster in multiple geographic zones. Watson Studio also provides
integration with GitHub so that you can manually download the notebooks if you want to use your
own backups.

© Copyright IBM Corp. 2018, 2022 3-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty
3.2. Watson Studio components

© Copyright IBM Corp. 2018, 2022 3-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Watson Studio
components

Figure 3-9. Watson Studio components

© Copyright IBM Corp. 2018, 2022 3-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Projects
• The architecture of Watson Studio is centered around the project.
• Integrate collaborators, data and analytic assets, tools, Gallery resources, your own data, and
so on to support finding insights for a well defined or narrow goal.

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-10. Projects

The architecture of Watson Studio is centered on projects where everything is seamlessly


integrated. You create and organize projects to suit your business needs. Projects consist of data
and operational assets, collaborators, and tools.
• Collaborators are the people on the team who work with the data. Data scientist tasks include
analyzing data and building models. Data engineer tasks include preparing and integrating
data. Collaborators can be added to projects as admins, editors, or viewers.
• Data assets are your data that is either in uploaded files or accessed through connections to
data sources.
• Operational assets are the objects that you create, such as scripts and models, to perform
actions on data
• Tools are the software that you use to derive insights from data. These tools are included with
the Watson Studio service on IBM Cloud:
▪ Data Refinery
▪ Jupyter notebook editor
▪ Rstudio
▪ SPSS Modeler
▪ Decision Optimization model builder
Watson Studio projects fully integrate with catalogs of the Watson Knowledge Catalog service,
and deployment spaces of the Machine Learning service.

© Copyright IBM Corp. 2018, 2022 3-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty
References
Watson Studio on Cloud Pak for Data as a Service
https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/wsl.html

© Copyright IBM Corp. 2018, 2022 3-16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Creating a project
• When you create a project in Watson Studio, you can create an empty project or preload your
project with data and operational assets.

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-11. Creating a project

When you create a project in Watson Studio, you can create an empty project or preload your
project with data and analytical assets:
• Create an empty project: Add the data that you want to prepare, analyze, or model. Choose
tools based on how you want to work: write code, create a flow on a graphical canvas, or
automatically build models.
• Create a project from a sample or file: Get started fast by loading existing assets. Choose a
project file from your system or choose a curated sample project.

© Copyright IBM Corp. 2018, 2022 3-17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Watson Studio and Cloud Object Storage


• Projects require an object storage to store non-database assets.
• An IBM Cloud Object Storage (COS) instance can be created when the project is created.
ƒ A project can be associated with an existing Cloud Object Storage instance.
• Information that is stored in IBM Cloud Object Storage is encrypted and resilient.
• Each project has its own dedicated bucket.
ƒ Buckets can be managed from the Watson Studio project interface.
• Cloud Object Storage supports two APIs:
ƒ Swift API: Available through Watson Studio
ƒ Amazon Simple Storage Service (S3) API

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-12. Watson Studio and Cloud Object Storage

Cloud Object Storage provides the space where non-database data for your project is stored.
For example, files, notebooks, experiments, and Data Refinery flows can be stored in COS.
An IBM Cloud Object Storage instance can be created at project creation time, or a new project
can be associated with an existing Cloud Object Storage instance.
Cloud Object Storage supports two APIs:
• The Swift API, which is available through Watson Studio.
• The S3 API, where you provide external credentials.
Information that is stored with IBM Cloud Object Storage is encrypted and resilient.
Cloud Object Storage uses buckets to organize the data. Each project has its own dedicated
bucket.
The Cloud Object Storage can be managed from the Watson Studio project interface.

© Copyright IBM Corp. 2018, 2022 3-18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Creating a project and defining its storage

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-13. Creating a project and defining its storage

Projects include integration with IBM Cloud Object Storage for storing project assets. When a
project is created, a new Cloud Object Storage service is created to provide an unstructured cloud
data store. It is also possible to associate a project with an existing Cloud Object Storage.
To create a new project:
1. Click + New.
2. Enter a name for the project.
3. In the Define storage pane, click Add.
4. Click Refresh.
5. The Cloud Object Storage service page with the New tab selected is displayed. Click Create.
6. Click Refresh in the project page.
7. The newly created Cloud Object Storage instance is associated with the project.
8. Click Create to create the project.

© Copyright IBM Corp. 2018, 2022 3-19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Watson Studio project tabs

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-14. Watson Studio project tabs

The Watson Studio project page includes tabs with specific information about the project. The
following tabs are included:
Overview. Provides basic information about the project such as:
• Assets
• Resource usage
• Project history
• Readme
Assets. Lists all the different types of assets that you can add to you project such as:
• Data assets
• Models
• Notebooks
• Dashboards
• Experiments
• Modeler flows

© Copyright IBM Corp. 2018, 2022 3-20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty
Jobs. A job is a way of running assets, such as Data Refinery flows or notebooks in a project in
Watson Studio.
From the Jobs tab of your project, you can:
• See the list of the jobs in your project
• View the details of each job. You can change the schedule settings of a job and pick a different
environment definition.
• Monitor job runs
• Create job
• Delete jobs
Reference:
Working in projects
https://dataplatform.cloud.ibm.com/docs/content/wsj/manage-data/manage-projects.html.

© Copyright IBM Corp. 2018, 2022 3-21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Watson Studio project tabs: Manage tab

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-15. Watson Studio project tabs: Manage tab

General. Project settings is the area to define key aspects of your project like its name and
description. Use Settings to add tools and key services, check storage, and define access tokens.
Access Control. Here you can add and manage collaborators for your project.
Environments. In this tab, you can define the hardware size and software configuration for the
runtime that is associated with Watson Studio tools. An environment definition defines the
hardware and software configuration that you can use to run tools like notebooks, model builder,
or the flow editor in Watson Studio. With environments, you have dedicated resources and flexible
options for the compute resources that are used by the tools.
Resource usage. Contains resource usage details.
Services & integrations: Shows IBM Cloud services and third-party services associated with this
project.

© Copyright IBM Corp. 2018, 2022 3-22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Assets
• An asset is an artifact
in a project that
contains information,
or metadata, about
data or data analysis.

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-16. Assets

An asset is an artifact in a project that contains information, or metadata, about data or data
analysis.
Data assets are the types of assets that point to data, for example, a file or a data set that is
accessed through a connection to an external data source.
Analytical assets are the types of assets that run code to analyze data.
An asset might have associated files or require specific IBM Cloud services. For example, many
types of analytical assets require a service.
The information that you can view about an asset and the actions that you can perform on an asset
vary by asset type. A few actions apply to all asset types, for example, you can create, edit the
properties of, and remove or delete all types of assets. You can edit the contents of most types of
assets in projects. For data assets that contain relational data, you can shape and cleanse the
data with the Data Refinery tool. For analytical assets, you can edit the contents in the appropriate
editor tool. In catalogs, you can edit only the metadata for the asset.
A new project has no assets. By default, the Data assets type is added with all project starters. To
add other asset types to your project, click New asset +.
Reference:
Asset types and properties
https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/assets.html

© Copyright IBM Corp. 2018, 2022 3-23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Watson Studio Gallery


Contains samples that you can use in your project:
• Sample notebooks to learn new techniques or to use as templates.
• Sample data sets to use in your project for analysis.

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-17. Watson Studio Gallery

The Watson Studio Gallery is a great place to get started. In the Gallery you can find open data
sets that are ready to use, including local, state, and government data. You just download the data
set and load it into your project.
The Gallery includes sample data sets and notebooks that apply to various topics such as
transportation, science and technology, health, law and government, economy and business, and
many more. You can add the data set or notebook to your project.
When you sig n into Watson Studio, scroll down in the home page to see the content that is most
recently added to the Gallery. You can click Explore to browse the Gallery content from here.
Alternatively, you can use the menu to go directly to the Gallery area where you find data sets and
notebooks.

© Copyright IBM Corp. 2018, 2022 3-24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Collaborating in a project
• Project collaborators share knowledge and resources.
• Admin role is required to manage collaborators (add, remove, and edit).
• Collaborators are added at the project level.
• Only collaborators in a project can access the project’s data and notebooks assets.

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-18. Collaborating in a project

After you create a project, add collaborators to share knowledge and resources.
Project collaborators share knowledge and resources and help one another complete jobs. You
must have the Admin role in the project to manage collaborators.
Only the collaborators in your project can access your data, notebooks, and other assets.
Collaborators can be removed from a project or have their permissions changes.
To add collaborators to your project:
1. From your project, click the Manage>Access Control tab, and then click Add collaborators.
2. Add the collaborators who you want to have the same access level:
▪ Type email addresses into the Find users field.
3. Choose the access level for the collaborators and click Add:
▪ Viewer: View the project.
▪ Editor: Control project assets.
▪ Admin: Control project assets, collaborators, and settings.
4. Add more collaborators with the same or different access levels.
5. Click Add.

© Copyright IBM Corp. 2018, 2022 3-25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty
If the added users have existing IBM Cloud accounts with Watson Studio activated, they are
added to your project immediately.
If an added user does not have an IBM Cloud account, the user receives an email invitation to
create an IBM Cloud account and activate Watson Studio. When the user activates Watson Studio,
the user can see your project and the user's status on your collaborators list changes
from Invited to Active. If necessary, you can resend or cancel an invitation.
Reference:
Project collaborators
https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/collaborate.html

© Copyright IBM Corp. 2018, 2022 3-26


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Watson Studio and Spark


• You need a Spark environment if:
ƒ Your notebook includes Spark APIs.
ƒ You create machine learning models or model flows with Spark runtimes.
ƒ You want to utilize parallel processing that is provided by the platform or by other services.
• Spark environments are available under Watson Studio
ƒ Default environment templates are listed on the project’s Environments page.
ƒ Watson Studio users can create Spark environments with varying hardware and software
configurations.

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-19. Watson Studio and Spark

Apache Spark is an open-source distributed cluster computing framework that is optimized for
extremely fast and large-scale data processing. Spark provides a core data processing engine.
Several libraries for SQL, machine learning, graph computation, and stream processing that is run
on Spark and can be used together in an application. To learn more about Apache Spark, see
documentation and examples at spark.apache.org.
All Watson Studio users can create Spark environments with varying hardware and software
configurations. Spark environments offer Spark kernels as a service (SparkR, PySpark, and Scala).
Each kernel gets a dedicated Spark cluster and Spark executors. Spark environments are offered
under Watson Studio and like default environments, consume capacity unit hours (CUHs) that are
tracked.
References
Predefined software specifications
https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/pm_service_supported_fra
meworks.html

© Copyright IBM Corp. 2018, 2022 3-27


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Spark default environments

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-20. Spark default environments

Spark environments offered under Watson Studio


The slide shows the default Spark environments definition under the project’s Environments tab.
You can select any of the default Spark environment templates for notebooks that are listed in the
slide. These default environment templates are listed on the project’s Environments page.
* Indicates that the environment includes libraries from IBM Runtime 22.1.
~ Indicates that the environment is deprecated. Consider switching to a newer version as soon as
you can.
# Indicates that the environment is in constricted mode. You can no longer create new notebooks
with this environment.
Reference:
Default Spark environment templates
https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/notebook-environments.ht
ml#default-spark

© Copyright IBM Corp. 2018, 2022 3-28


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty
3.3. Jupyter notebooks

© Copyright IBM Corp. 2018, 2022 3-29


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Jupyter notebooks

Figure 3-21. Jupyter notebooks

© Copyright IBM Corp. 2018, 2022 3-30


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Jupyter notebooks overview


• A web-based environment where you can run small pieces of code that process your data and
immediately visualize the results.
• Include all the building blocks to work with data:
ƒ The data
ƒ The code computations that process the data
ƒ Visualizations of the results
ƒ Text and rich media to enhance understanding
• Other options:
ƒ Rstudio for statistical computing

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-22. Jupyter notebooks overview

A Jupyter notebook is a web-based environment for interactive computing. You can run small
pieces of code that process your data, and you can immediately view the results of your
computation. Notebooks include all of the building blocks that you need to work with data:
• The data
• The code computations that process the data
• Visualizations of the results
• Text and rich media to enhance understanding
From markdown and live code to visualizations, notebooks include all of the building blocks you
need to work with data and enhance your understanding.
You can use notebooks to add formatted text around executable code to describe what is being
done and show the result, including graphics, concurrently.
Another popular environment for data science, statistical analysis, and graphic representation is
provided by the R language. Watson Studio includes RStudio for people that prefer the R
development environment.

© Copyright IBM Corp. 2018, 2022 3-31


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Parts of a notebook
• Menu bar and toolbar

• Action bar

• Cells in a Jupyter Notebook:


ƒ Code cells
ƒ Markdown cells

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-23. Parts of a notebook

The menu bar controls most of the operations and settings for the notebook. Simple and common
functions are supported through the menu bar.
From the action bar, you can select features that enhance notebook collaboration. From the
action bar, you can:
• Publish your notebook as a gist or to GitHub.
• Create a permanent URL so that anyone with the link can view your notebook.
• Schedule to run your notebook at a specific time.
• Add a project token so that code can access the project resources.
• View your notebook information. Change the name of your notebook by editing it in
the Name field. If your notebook runs in an environment, you can view the environment
details and runtime status.
• Save versions of your notebook.
• View and add data sources.
• Post comments to project collaborators.
• Integrate data into your notebook.
• Find resources in the Gallery, for example, useful data sets.

© Copyright IBM Corp. 2018, 2022 3-32


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty
Cells in a Jupyter notebook
A Jupyter notebook consists of a sequence of cells. The flow of a notebook is sequential. You
enter code into an input cell, and when you run the cell, the notebook executes the code and
prints the output of the computation to an output cell.
You can change the code in an input cell and re-run the cell as often as you like. In this way, the
notebook follows a read-evaluate-print loop paradigm. You can choose to use tags to describe
cells in a notebook.
The behavior of a cell is determined by a cell’s type. The types of cells include:
• Code cells: They are the cells where you edit and run the code. The output of the cell appears
beneath the cell. Tags can be used to describe the cell for code readability and maintainability.
Cells can be rerun as often as you like.
• Markdown cells are used to document and comment the process. You can use markdown cells
to structure your notebook by using the markdown language. Images and file attachments can
be added to the notebook by using the markdown cells.

© Copyright IBM Corp. 2018, 2022 3-33


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Creating notebooks
• Must have a project and a Spark service or environment.
• Options to create a Jupyter notebook:
ƒ Blank, from a file, from a URL
ƒ Copy sample notebook from the Gallery
• Specify a name for the notebook.

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-24. Creating notebooks

If your notebook includes Spark APIs, or you want to create machine learning models or model
flows with Spark runtimes, you need to associate the tool with a Spark service or environment.
With Spark environments, you can configure the size of the Spark driver and the size and number
of the executors.
When the project is set up, you can create the notebook by using one of these ways:
• Blank
• From a file
• From a URL
You must specify a name for your notebook. You can create a notebook by importing a Python,
Scala, or R notebook file (.ipynb) from your local workstation. You can also create a notebook from
a URL by providing the URL.
Alternatively, you can copy a sample notebook from the Gallery to help you get started.

© Copyright IBM Corp. 2018, 2022 3-34


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Creating notebooks (cont.)


• From the project, click Assets> New Asset + > Code editors > Jupyter notebook editor
ƒ Select an option: Blank, From file, or From URL.

• Copy sample from Gallery.

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-25. Creating notebooks (cont.)

Create a notebook file


To create a notebook file in the project:
1. From your project, click Assets> New Asset + > Code editors > Jupyter notebook editor
2. In the New Notebook page, specify the method to use to create your notebook. You can
create a blank notebook, upload a notebook file from your file system, or upload a notebook
file from a URL. The notebook that you create or select must be a .ipynb file.
3. Specify the language: Python, R, or Scala.
4. Specify the runtime environment. After you create an environment definition on
the Environments page of your project, it appears in the list of runtimes that you can select
when you create the notebook.
5. Click Create Notebook. The notebook opens in edit mode.

© Copyright IBM Corp. 2018, 2022 3-35


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty
Copy a sample notebook from the Gallery
Sample notebooks from the Gallery are based on real-world scenarios and contain many useful
examples of computations and visualizations that you can adapt to your analysis needs.
To copy a sample notebook:
1. Click Gallery from the Watson Studio menu, then filter for Notebooks to show only notebook
cards.
2. Find the card for the sample notebook that you want and click the card. You can view the
notebook contents to browse the steps and the code that it contains.
3. To work with a copy of the sample notebook, click the Copy icon. The New Notebook screen
opens.
4. Choose the project for the notebook.
5. Specify the runtime environment. After you create an environment definition on
the Environments page of your project, it appears in the list of runtimes that you can select
when you create the notebook.
6. Click Create Notebook. The notebook opens in edit mode.

© Copyright IBM Corp. 2018, 2022 3-36


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Coding and running notebooks


• Import libraries:
ƒ Preinstalled from Python or R.
ƒ Install custom or third-party libraries for any language. For Scala, no libraries are preinstalled in the
Spark service.

• Load and access data:


ƒ Add a file from the local system to your object store.
ƒ Use a free data set from the Watson Studio home page.
ƒ Load data from a data source connection.

• Prepare and analyze the data.

• Collaborate with other project members or share outside Watson Studio.

• Visualize the results.

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-26. Coding and running notebooks

To code and run notebooks, complete the following steps:


1. Import the libraries that you need for the notebook. You can import preinstalled libraries if you
are using Python or R. If you are using Scala, you must install the libraries manually, and they
are available for the duration of that notebook.
2. Load and access the data. To load data into your own notebooks, you can choose one of these
options:
▪ Add a file from your local system to your object storage.
▪ Use a free data set from the Gallery.
▪ Load data from a data source connection, such as an external data source or another IBM
Cloud service.
3. Prepare and analyze data
With the libraries and data loaded, you can start data analysis by preparing the data, analyzing
the data, and making predictions. You can write your own code with Python functions to work
with data and IBM Cloud Object Storage in notebooks.
4. Collaborate with other project members and share your notebook with people outside Watson
Studio.
You can create a URL to share the last saved version of a notebook on social media or with
people outside of Watson Studio. The URL shows a read-only view of the notebook. Anyone
who has the URL can view or download the notebook. Whenever you save a new version of the
notebook with the File > Save Version command, the URL shows the new version. The shared
notebook shows the author of the shared version and when the notebook version was last
updated.

© Copyright IBM Corp. 2018, 2022 3-37


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty
5. Visualize the data. Use visualizations in your notebooks to present data visually to help
identify patterns, gain insights, and make decisions. Many of your favorite open source
visualization libraries, such as matplotlib, are pre-installed on Watson Studio. All that you have
to do is import them.

© Copyright IBM Corp. 2018, 2022 3-38


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Unit summary • Describe Watson Studio.


• Identify industry use cases.
• List Watson Studio offerings.
• Create Watson Studio projects.
• Describe Watson Studio and Spark environment.
• Describe Watson Studio and Object Storage.
• Explain Watson Studio high availability considerations.
• Prepare and analyze data.
• Use Jupyter notebooks.

© Copyright IBM Corporation 2018, 2022

Figure 3-27. Unit summary

© Copyright IBM Corp. 2018, 2022 3-39


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Review questions
1. True or False: Watson Studio is designed only for the data scientist persona.

2. True or False: Object storage provides the space where unstructured data for your project is
stored.

3. True or False: Collaborators can be given different access levels.

4. True or False: Collaboration within Watson Studio is an optional add-on component that
must be purchased.

5. True or False: Watson Studio Gallery provides access to sample notebooks and data sets
that you can use.

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-28. Review questions

© Copyright IBM Corp. 2018, 2022 3-40


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Review answers
1. True or False: Watson Studio is designed only for the data scientist persona.

2. True or False: Object storage provides the space where unstructured data for your project is
stored.

3. True or False: Collaborators can be given different access levels.

4. True or False: Collaboration within Watson Studio is an optional add-on component that
must be purchased.

5. True or False: Watson Studio Gallery provides access to sample notebooks and data sets
that you can use.

Introduction to IBM Watson Studio © Copyright IBM Corporation 2018, 2022

Figure 3-29. Review answers

1. True or false: Watson Studio is designed only for the data scientist persona.
False: The data engineer, the data scientist, the business analyst, and the app developer. Each
persona has primary tools that help them do their job. For example, the data scientist's main
tool is Watson Studio but other personas can use it as it relates to their jobs. . Also, there
might be a team of different personas. Whatever the case is, you must decide what tool is
correct for the job, regardless of the personas. The definitions of personas can vary between
different companies and evolve over time.”
2. True or False: Object storage provides the space where unstructured data for your project is
stored.
3. True or False: Collaborators can be given certain access levels. 
True: “Add collaborators to your project by using their email addresses. If they have an
existing account on IBM Cloud, they are added immediately. Otherwise, they receive an invite
to create a Watson Studio account. Choose the permissions for each collaborator. The Admin
role can control project assets, collaborators, and settings. The Editor role can control project
assets. The Viewer role can view the project. Collaborators can be removed from a project or
have their permissions updated.”
4. True or False: Collaboration within Watson Studio is an optional add-on component that must
be purchased.
False: “Collaboration is a standard feature in Watson Studio.”
5. True or False: Watson Studio Gallery provides access to sample notebooks and data sets that
you can use. 
True: “Watson Studio Gallery is a place where you can find and use open data sets that are
ready to use, including local, state, and government data. You download the data set and load
it into your project. If you are working within a notebook, you can add the data set to the

© Copyright IBM Corp. 2018, 2022 3-41


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty
project. Gallery is a great place to get started if you are exploring the data science space.
There are sample notebooks to get you started or to learn about new libraries and use cases.”

© Copyright IBM Corp. 2018, 2022 3-42


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Exercise: Getting started with Watson Studio

Figure 3-30. Exercise: Getting started with Watson Studio

© Copyright IBM Corp. 2018, 2022 3-43


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 3. Introduction to IBM Watson Studio

Uempty

Exercise • This exercise introduces you to the basic tasks that you will perform
when using Watson Studio.
objectives
• After completing this exercise, you should be able to:
ƒ Create a Watson Studio project.
ƒ Manage the project.
ƒ Assign collaborators.
ƒ Load a data set into the project’s object store.
ƒ Manage Cloud Object Storage.
ƒ Analyze data by using Watson Studio.
ƒ Use scikit-learn for linear regression.

© Copyright IBM Corporation 2018, 2022

Figure 3-31. Exercise objectives

© Copyright IBM Corp. 2018, 2022 3-44


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Unit 4. Introduction to IBM Watson


Machine Learning and AutoAI
Estimated time
01:00

Overview
This unit provides an overview of the Cross-Industry Standard Process for Data Mining
(CRISP-DM) and explains the process of preparing data for machine learning. It provides an
overview of the Watson Machine Learning service available on IBM Cloud and the AutoAI tool
available in Watson Studio.

© Copyright IBM Corp. 2018, 2022 4-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Unit objectives • Describe the Cross-Industry Standard Process for Data Mining
(CRISP-DM) process model.
• Describe the phases of data preparation.
• Describe Watson Machine Learning features and capabilities.
• Explain the value of the AutoAI tool and its use.

© Copyright IBM Corporation 2018, 2022

Figure 4-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 4-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Topics • Cross-Industry Standard Process for Data Mining


• Data preparation
• Watson Machine Learning
• AutoAI

© Copyright IBM Corporation 2018, 2022

Figure 4-2. Topics

© Copyright IBM Corp. 2018, 2022 4-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty
4.1. Cross-Industry Standard Process for Data
Mining

© Copyright IBM Corp. 2018, 2022 4-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Cross-Industry
Standard Process
for Data Mining

Figure 4-3. Cross-Industry Standard Process for Data Mining

© Copyright IBM Corp. 2018, 2022 4-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Cross-Industry Standard Process for Data Mining overview


• CRISP-DM stands for Cross-Industry Standard Process for Data Mining.
• It is an open standard guide that describes common approaches that are used by data mining
experts.
• As a methodology, CRISP-DM includes descriptions of the typical phases of a project, including
tasks details.
• As a process model, CRISP-DM provides an overview of the data mining lifecycle.

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-4. Cross-Industry Standard Process for Data Mining overview

CRISP-DM is an industry-proven way to guide your data mining efforts. It is the most widely used
analytics model. It describes common approaches that are used by data mining experts.
As a methodology, it includes descriptions of the typical phases of a project, the tasks that are
involved with each phase, and an explanation of the relationships between these tasks.
As a process model, CRISP-DM provides an overview of the data mining lifecycle. In a nutshell, it
consolidates preferred practices.
References
CRISP-DM - Step-by-step data mining guide
https://www.semanticscholar.org/paper/CRISP-DM-1.0%3A-Step-by-step-data-mining-guide-C
hapman-Clinton/54bad20bbc7938991bf34f86dde0babfbd2d5a72

© Copyright IBM Corp. 2018, 2022 4-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

CRISP-DM lifecycle

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-5. CRISP-DM lifecycle

The lifecycle model consists of six phases with arrows indicating the most important and frequent
dependencies between phases. The sequence of the phases is not strict. In fact, most projects
move back and forth between phases as necessary.
It starts with business understanding, and then moves to data understanding, data preparation,
modelling, evaluation, and deployment.
The CRISP-DM model is flexible and can be customized easily. For example, if your organization
aims to detect money laundering, it is likely that you examine large amounts of data without a
specific modelling goal. Instead of modelling, your work focuses on data exploration and
visualization to uncover suspicious patterns in financial data.
In such a situation, the modelling, evaluation, and deployment phases might be less relevant than
the data understanding and preparation phases. However, it is still important to consider some of
the questions that are raised during these later phases for long-term planning and future data
mining goals.
Reference:
CRISP-DM Help Overview
https://www.ibm.com/docs/en/spss-modeler/18.2.0?topic=dm-crisp-help-overview

© Copyright IBM Corp. 2018, 2022 4-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Phases in CRISP-DM

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-6. Phases in CRISP-DM

This slide summarizes the tasks of each phase in CRISP-DM.

© Copyright IBM Corp. 2018, 2022 4-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty
4.2. Data preparation

© Copyright IBM Corp. 2018, 2022 4-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Data preparation

Figure 4-7. Data preparation

© Copyright IBM Corp. 2018, 2022 4-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Data preparation
• The process of preparing data for a machine learning algorithm has the following phases:
ƒ Data selection
ƒ Data preprocessing
ƒ Data transformation

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-8. Data preparation

Machine learning algorithms depend highly on the quality and quantity of data. You must provide
these algorithms with the correct data. Data preparation is a large subject that can involve many
iterations, exploration, and analysis. Becoming proficient at data preparation will make you a
master at machine learning.
This section covers the basic tasks of the data preparation process: data selection, data
preprocessing, and data transformation.
References
What Is Data Processing: Cycle, Types, Methods, Steps and Examples
https://www.simplilearn.com/data-preprocessing-tutorial
How to Prepare Data For Machine Learning
https://machinelearningmastery.com/how-to-prepare-data-for-machine-learning

© Copyright IBM Corp. 2018, 2022 4-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Data selection
• Think about:
ƒ What data is available, what data is missing, and what data can be removed?
ƒ Is the selected sample an accurate representation of the entire population?
ƒ Is more data better?

Banko and Brill [2001] http://www.aclweb.org/anthology/P01-1005


Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-9. Data selection

This step is concerned with selecting a subset of all the available data with which you are working.
Consider what data is available, what data is missing, and what data can be removed.
Make some assumptions about the data that you require and record those assumptions. Ask
yourself:
• What data is available? For example, through which media, such as database tables or other
systems? Is it structured or unstructured? Make sure that you are aware of everything that you
can use.
• What data is not available, and what data do you want to get? For example, data that is not or
cannot be recorded. Can you develop or simulate this data?
• What data can be removed (because it does not address the problem)? Document which data
you excluded and why.
It is common to think that the more data we have the better result we get, but this is not
necessarily true. According to the paper "Scaling to Very Very Large Corpora for Natural Language
Disambiguation" by Microsoft Researchers Banko and Brill [2001] [1], for a problem, different
algorithms perform virtually the same and the accuracy increases when adding more data (in this
case, words). But, for large amounts of data, the improvements start to become negligible.

© Copyright IBM Corp. 2018, 2022 4-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty
References
Scaling to Very Very Large Corpora for Natural Language Disambiguation
http://www.aclweb.org/anthology/P01-1005
Phase 3 of the CRISP-DM Process Model: Data Preparation
https://www.dummies.com/programming/big-data/phase-3-of-the-crisp-dm-process-model-dat
a-preparation/
What Is Data Processing: Cycle, Types, Methods, Steps and Examples
https://www.simplilearn.com/data-preprocessing-tutorial
How to Prepare Data For Machine Learning
https://machinelearningmastery.com/how-to-prepare-data-for-machine-learning/

© Copyright IBM Corp. 2018, 2022 4-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Data selection: Samples selection


• Selecting the correct size of the sample is a key step in data preparation. Samples that are too
large or too small might give skewed results.
ƒ Sampling noise
ƒ Sampling bias

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-10. Data selection: Samples selection

Selecting the correct size of the sample is a key step in data preparation. Samples that are too
large or too small might give skewed results.
Sampling noise: Smaller samples cause sampling noise because they are trained on
non-representative data.
Sampling bias: A sample is biased if certain samples are underrepresented or overrepresented
relative to others in the population. Larger samples work well if there is no sampling bias, that is,
when the correct data is picked.
References
What Is Data Processing: Cycle, Types, Methods, Steps and Examples
https://www.simplilearn.com/data-preprocessing-tutorial

© Copyright IBM Corp. 2018, 2022 4-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Data selection: Survey sampling


• Undercoverage
• Non-response bias
• Voluntary response bias

Unrepresentative
Samples
Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-11. Data selection: Survey sampling

A good sample is representative, meaning that each sample point represents the attributes of a
known number of population elements. The bias that results from an unrepresentative sample is
called selection bias. There are various types of bias in surveys, such as undercoverage,
non-response bias, and voluntary response bias. To explain these types, assume that you want to
conduct a survey about customers and their purchase preferences:
• Undercoverage: Undercoverage occurs when some members of the population are
inadequately represented in the sample. For example, when a minority is underrepresented in
a sample, this situation can affect the validity of the sample. In this example, assume that you
underrepresented the customers who have a low income.
• Non-response bias: Sometimes, members that are chosen for the sample are unwilling or
unable to participate in the survey. Non-response bias is the bias that results when
respondents differ in meaningful ways from non-respondents. This bias can affect the validity
of the sample. Non-response bias is a common problem with mail surveys because the
response rate is often low, making mail surveys vulnerable to non-response bias.
• Voluntary response bias: This bias occurs when sample members are
self-selected volunteers, as in voluntary samples. When this happens, the resulting sample
tends to over represent individuals who have strong opinions.
References
Survey sampling
https://en.wikipedia.org/wiki/Survey_sampling
Bias Due to Unrepresentative Samples
https://sites.google.com/site/apstatisticssurveys/bias-in-surveys/bias-due-to-unrepresentative-
samples

© Copyright IBM Corp. 2018, 2022 4-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Data preprocessing: Challenges


• Data challenges:
ƒ Noise and outliers
ƒ Missing values
ƒ Inconsistent values
ƒ Duplicate data
• Data preprocessing is a data mining technique that involves transforming raw data into an
understandable format.

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-12. Data preprocessing: Challenges

Why we use data preprocessing


In actual scenarios, data is generally incomplete:
• Data might lack attribute values, lacking certain attributes of interest.
• Data is noisy when it contains errors or outliers. For example, human height as a negative
value.
• Data might be inconsistent, containing discrepancies in codes or names. For example, a
record for two employees having the same ID.
We usually come across much raw data that is not fit to be readily processed by machine learning
algorithms. We must preprocess the raw data before it is fed into various machine learning
algorithms. Organize your selected data by formatting, cleaning, and sampling from the data. Poor
data quality negatively affects many data processing efforts.
References
Data Preprocessing: 6 Necessary Steps for Data Scientists
https://hackernoon.com/what-steps-should-one-take-while-doing-data-preprocessing-502c993
e1caa
Machine Learning(ML) — Data Preprocessing
https://medium.com/datadriveninvestor/machine-learning-ml-data-preprocessing-5b346766fc
48
How to Prepare Data For Machine Learning
https://machinelearningmastery.com/how-to-prepare-data-for-machine-learning

© Copyright IBM Corp. 2018, 2022 4-16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Data preprocessing: Steps overview


1. Data cleaning: Complete missing values, smooth noisy data, identify or remove outliers, and
resolve inconsistencies.
2. Data integration: Using multiple databases, other data sources, or files.
3. Data sampling: Faster for exploring and prototyping.
4. Data dimensionality reduction: Reducing the volume but producing the same or similar
analytical results.
5. Data formatting: The data that you selected might not be in a format that is suitable for you
to use.

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-13. Data preprocessing: Steps overview

The following list summarizes the steps that are used in preprocessing data:
1. Data cleaning: Complete missing values, smooth noisy data, identify or remove outliers, and
resolve inconsistencies.
2. Data integration: Using multiple databases, other data sources, or files.
3. Data sampling: You can take a smaller representative sample of the selected data that might
be much faster for exploring and prototyping solutions before considering the whole data set.
4. Data dimensionality reduction: Reducing the dimensions of the data and producing the same
or similar analytical results. This is a kind of data compression that uses less memory or disk
space and speeds the learning algorithm. For example, assume that you have a feature for size
in centimeters and another feature for size in inches. By removing one of those redundant
features, you reduce the dimensions of your data from 3D to 2D.
5. Data formatting: The data that you selected might not be in a format that is suitable for you to
use. For example, the data might be in a relational database and you want it in a
comma-separated file.
References
Machine Learning(ML) — Data Preprocessing
https://medium.com/datadriveninvestor/machine-learning-ml-data-preprocessing-5b346766fc
48
How to Prepare Data For Machine Learning
https://machinelearningmastery.com/how-to-prepare-data-for-machine-learning/

© Copyright IBM Corp. 2018, 2022 4-17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Data transformation: Steps overview (cont.)


• Data transformation:
ƒ Scaling
ƒ Aggregation
ƒ Decomposition

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-14. Data transformation: Steps overview (cont.)

Data transformation (also called feature engineering) is a set of actions that covers transformation
of the processed data. Engineering features from your data can take some time, but they can
enhance the machine learning performance. There are three common data transformations:
• Scaling: The pre-processed data might contain attributes with a mixture of scales for various
quantities, such as meters, grams, and dollars. The features should have the same scale, for
example, 0 (smallest value) to 1 (largest value).
• Aggregation: There might be features that can be aggregated into a single feature, which is
more meaningful to the problem that you are trying to solve.
• Decomposition: There might be complex features where it is more useful to split into parts.
For example, a feature that represents a date and time stamp in a long format can be split out
further into only the hour of the day. Think about what your problem really needs.
References
Machine Learning(ML) — Data Preprocessing
https://medium.com/datadriveninvestor/machine-learning-ml-data-preprocessing-5b346766fc
48
How to Prepare Data For Machine Learning
https://machinelearningmastery.com/how-to-prepare-data-for-machine-learning/

© Copyright IBM Corp. 2018, 2022 4-18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty
4.3. Watson Machine Learning

© Copyright IBM Corp. 2018, 2022 4-19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Watson Machine
Learning

Figure 4-15. Watson Machine Learning

© Copyright IBM Corp. 2018, 2022 4-20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Watson Machine Learning


• Machine Learning is a service on IBM Cloud with features for training and deploying machine
learning models and neural networks.
• Watson Machine Learning is integrated with IBM Watson Studio.
• Enables users to perform two fundamental operations of machine learning: training and
scoring.
ƒ Training is the process of refining an algorithm so that it can learn from a data set.
ƒ Scoring is the operation of predicting an outcome by using a trained model.

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-16. Watson Machine Learning

Machine Learning is a service on IBM Cloud with features for training and deploying machine
learning models and neural networks. To design, train, and deploy machine learning models in
IBM Watson Studio, you must associate a Watson Machine Learning service instance and
supporting services (such as IBM Cloud Object Storage) with a project.
Machine Learning enables users to perform two fundamental operations of machine learning:
training and scoring.
• Training is the process of refining an algorithm so that it can learn from a data set. The output
of this operation is called a model. A model encompasses the learned coefficients of
mathematical expressions.
• Scoring is the operation of predicting an outcome by using a trained model. The output of the
scoring operation is another data set containing predicted values.
References
Deploying models with Watson Machine Learning
https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml-overview.html

© Copyright IBM Corp. 2018, 2022 4-21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Watson Machine Learning features


• Interfaces for building, training, and deploying models:
ƒ Python client library
ƒ Command-line interface (CLI)
ƒ REST API
• Deployment infrastructure
• Distributed deep learning
• GPUs for faster training

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-17. Watson Machine Learning features

The Watson Machine Learning service provides the following features:


• Interfaces for building, training, and deploying models: a Python client library, CLI, and a REST
API.
• Deployment infrastructure for hosting your trained models. Although training is a critical step
in the machine learning process, Watson Machine Learning enables you to streamline the
functioning of your models by deploying them and getting business value from them over time
and through all their iterations.
• Distributed deep learning for distributing training runs across multiple servers.
• GPUs for faster training.
References
Deploying models with Watson Machine Learning
https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml-overview.html

© Copyright IBM Corp. 2018, 2022 4-22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Watson Machine Learning personas


• Data scientists:
ƒ Use data transformations and machine learning algorithms.
ƒ Use notebooks or external tools.
ƒ Often collaborate with data engineers to explore and understand the data.
• Developers build intelligent applications that use the predictions output of machine learning
models.

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-18. Watson Machine Learning personas

Data scientists create machine learning pipelines that use data transformations and machine
learning algorithms. They typically use Notebooks or external tools to train and evaluate their
models. Data scientists often collaborate with data engineers to explore and understand the data.
Developers build intelligent applications that use the predictions that are output by machine
learning models.
References
Deploying models with Watson Machine Learning
https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml-overview.html

© Copyright IBM Corp. 2018, 2022 4-23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Watson Machine Learning: Building the model


• You can build your model by using one of the following tools (shown on this and the next
slides):
ƒ Notebook.
ƒ SPSS Modeler flow (Flow Editor):
í Use the Flow Editor to create a machine learning flow.
í Use the Flow Editor to create a deep learning flow.
í Use the Flow Editor to create SparkML flow type.
í

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-19. Watson Machine Learning: Building the model

Data scientists can use Jupyter notebooks to load and process data, create and deploy Watson
Machine Learning models.
You can use a notebook to create or use a machine learning model. You can use the notebook to
write the code and implement the machine learning API. After the model is created, trained, and
deployed you can run the deployed model in a notebook.
With SPSS Modeler flows in Watson Studio, you can quickly develop predictive models by using
business expertise and deploying them into business operations to improve decision making.
These flows are designed around the long-established SPSS Modeler client software and the
industry-standard CRISP-DM model.
You can create a machine learning flow, which is a graphical representation of a data model, or a
deep learning flow, which is a graphical representation of a neural network design, by using the
SPSS modeler (Flow Editor). Use it to prepare or shape data, train or deploy a model, or transform
data and export it back to a database table or file in IBM Cloud Object Storage.
You can also create a machine learning model with Apache Spark MLlib nodes by adding the
Modeler flow asset type to your project and then selecting SparkML as the flow type.
References
Notebooks
https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/notebooks-parent.html
Creating SPSS Modeler flows
https://dataplatform.cloud.ibm.com/docs/content/wsd/spss-modeler.html

© Copyright IBM Corp. 2018, 2022 4-24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Watson Machine Learning: Building the model (cont.)


• AutoAI:
ƒ Data pre-processing
ƒ Automated model selection
ƒ Automated feature engineering
ƒ Hyperparameter optimization

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-20. Watson Machine Learning: Building the model (cont.)

The AutoAI graphical tool in Watson Studio automatically analyzes your data and generates
candidate model pipelines that are customized for your predictive modeling problem. These
model pipelines are created over time as AutoAI analyzes your data set and discovers data
transformations, algorithms, and parameter settings that work best for your problem setting.
Results are displayed on a leaderboard, showing the automatically generated model pipelines
that are ranked according to your problem optimization objective.
The next topic covers the AutoAI tool in more detail.

© Copyright IBM Corp. 2018, 2022 4-25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty
Exercise 4 – Section 1: Getting started with Watson Machine
Learning

Figure 4-21. Exercise 4 – Section 1: Getting started with Watson Machine Learning

© Copyright IBM Corp. 2018, 2022 4-26


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Exercise • This exercise introduces you to the basic tasks that you have to
perform while building machine learning models using the Machine
objectives Learning service and Watson Studio.
• After completing this exercise, you should be able to:
ƒ Add a machine learning model that is saved in Predictive Model Markup
Language (PMML) format to the project.
ƒ Deploy the machine learning model.
ƒ Test the machine learning model.

© Copyright IBM Corporation 2018, 2022

Figure 4-22. Exercise objectives

© Copyright IBM Corp. 2018, 2022 4-27


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty
4.4. AutoAI

© Copyright IBM Corp. 2018, 2022 4-28


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

AutoAI

Figure 4-23. AutoAI

© Copyright IBM Corp. 2018, 2022 4-29


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

What is AutoAI or AutoML?


• AutoAI or AutoML generally refers to an algorithmic process or set of processes to create or
discover the best pipelines for a given data set and prediction problem (problem type or
metric)
• Benefits
ƒ Build models faster
í Automate data preparation and model development

ƒ Find signal from noise


í Auto-feature engineering makes it easy to extract
more predictive power from your data

ƒ Rank and explore models


í Quickly compare candidate pipelines to find the
best model for the job

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-24. What is AutoAI or AutoML?

The AutoAI graphical tool in Watson Studio automatically analyzes your data and generates
candidate model pipelines that are customized for your predictive modeling problem. These
model pipelines are created over time as AutoAI analyzes your data set and discovers data
transformations, algorithms, and parameter settings that work best for your problem setting.
Results are displayed on a leaderboard, showing the automatically generated model pipelines
that are ranked according to your problem optimization objective.
Types of prediction problems are:
▪ Binary classification
▪ Multiclass classification
▪ Regression
▪ Time series forecast
Reference:
AutoML – IBM AutoAI
https://www.ibm.com/cloud/watson-studio/autoai

© Copyright IBM Corp. 2018, 2022 4-30


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

AutoAI process: Tasks

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-25. AutoAI process: Tasks

AutoAI automatically runs the following tasks to build and evaluate candidate model pipelines:
Data pre-processing
AutoAI applies various algorithms, or estimators, to analyze, clean, and prepare your raw data for
machine learning. It automatically detects and categorizes features based on data type, such as
categorical or numerical. Depending on the categorization, it uses hyperparameter optimization to
determine the best combination of strategies for missing value imputation, feature encoding, and
feature scaling for your data.
Automated model selection
AutoAI uses a novel approach that enables testing and ranking candidate algorithms against small
subsets of the data, gradually increasing the size of the subset for the most promising algorithms
to arrive at the best match. This approach saves time without sacrificing performance. It enables
ranking many candidate algorithms and selecting the best match for the data.
Automated feature engineering
Feature engineering attempts to transform the raw data into the combination of features that best
represents the problem to achieve the most accurate prediction. AutoAI uses a novel approach
that explores various feature construction choices in a structured, non-exhaustive manner while
progressively maximizing model accuracy by using reinforcement learning. This process results in
an optimized sequence of transformations for the data that best match the algorithms of the
model selection step.

© Copyright IBM Corp. 2018, 2022 4-31


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty
Hyperparameter optimization
A hyperparameter optimization step refines the best performing model pipelines. AutoAI uses a
novel hyperparameter optimization algorithm that is optimized for costly function evaluations,
such as model training and scoring, that are typical in machine learning. This approach enables
fast convergence to a good solution despite long evaluation times of each iteration.
References
AutoAI Overview
https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/autoai-overview.html
AutoAI implementation details
https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/autoai-details.html

© Copyright IBM Corp. 2018, 2022 4-32


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

AutoAI terminology
• IBM implementation of AutoAI in Watson Studio adopts open-source terminology.

• Machine learning pipeline: A set of steps for creating a model (a workflow). Typical steps in a
pipeline are: ingest, clean, transform, and model with hyperparameter optimization.

• Estimators: Algorithms or models. For example: logistic regression, and random forest.

• Hyper Parameter Optimization (HPO): The process of training the models with different
parameters (specific to each algorithm).

• Model evaluation metrics: Various model evaluation metrics used by data scientists, for
example AUC-ROC and F1 Score.

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-26. AutoAI terminology

AutoAI is a tool in Watson Studio. It requires a Watson Studio project and an instance of the
Machine Learning service.

© Copyright IBM Corp. 2018, 2022 4-33


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty
Exercise 4 – Section 2: Creating an AutoAI experiment from
marketing data

Figure 4-27. Exercise 4 – Section 2: Creating an AutoAI experiment from marketing data

© Copyright IBM Corp. 2018, 2022 4-34


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Exercise • In this section, you explore how to use the AutoAI tool in Watson
Studio to automate most of the phases in the AI lifecycle and
objectives generate a trained model quickly with no coding.
• After completing this exercise, you should be able to:
ƒ Explain the benefits of automating AI with AutoAI.
ƒ Create an AutoAI experiment in a Watson Studio project.
ƒ Customize an AutoAI experiment.
ƒ Monitor pipelines in an AutoAI experiment.
ƒ Compare the quality of trained models and select the best one for further
refinement.
ƒ Deploy the selected model online and score the trained model.

© Copyright IBM Corporation 2018, 2022

Figure 4-28. Exercise objectives

© Copyright IBM Corp. 2018, 2022 4-35


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Unit summary • Describe the Cross-Industry Standard Process for Data Mining
(CRISP-DM) process model.
• Describe the phases of data preparation.
• Describe Watson Machine Learning features and capabilities.
• Explain the value of the AutoAI tool and its use.

© Copyright IBM Corporation 2018, 2022

Figure 4-29. Unit summary

© Copyright IBM Corp. 2018, 2022 4-36


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Review questions
1. In CRISP-DM, which phase focuses on machine learning?

a. Business understanding

b. Data preparation

c. Modeling

d. Evaluation

e. Deployment

2. True or False: Machine Learning integrates with Watson Studio.

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-30. Review questions

© Copyright IBM Corp. 2018, 2022 4-37


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Review questions (cont.)


3. The most time-consuming phase in CRISP-DM is:
a. Business understanding
b. Data preparation
c. Evaluation preparation
d. Deployment preparation

4. Which of the following is not part of data processing?


a. Data cleaning

b. Data prediction

c. Data integration

d. Data sampling

e. Data formatting

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-31. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 4-38


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Review questions (cont.)


5. Which of the following are Watson Machine Learning personas?
a. Data scientist

b. Business analyst

c. Developers

d. Project manager

e. Tester

f. All of the above

g. A & C

h. C & E

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-32. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 4-39


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Review questions (cont.)


6. Which of the following is part of the AutoAI process to build candidate pipelines?

a. Create a machine learning flow.

b. Create a deep learning flow.

c. Automated model selection.

d. Create SparkML flow type.

e. Hyperparameter optimization.

f. A & B

g. C & E

h. All of the above

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-33. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 4-40


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Review answers
1. In CRISP-DM, which phase focuses on machine learning?

a. Business understanding

b. Data preparation

c. Modeling

d. Evaluation

e. Deployment

2. True or False: Machine Learning integrates with Watson Studio.

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-34. Review answers

© Copyright IBM Corp. 2018, 2022 4-41


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Review answers (cont.)


3. The most time-consuming phase in CRISP-DM is:
a. Business understanding
b. Data preparation
c. Evaluation preparation
d. Deployment preparation

4. Which of the following is not part of data processing?


a. Data cleaning

b. Data prediction

c. Data integration

d. Data sampling

e. Data formatting

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-35. Review answers (cont.)

© Copyright IBM Corp. 2018, 2022 4-42


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Review answers (cont.)


5. Which of the following are Watson Machine Learning personas?
a. Data scientist

b. Business analyst

c. Developers

d. Project manager

e. Tester

f. All of the above

g. A & C

h. C & E

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-36. Review answers (cont.)

© Copyright IBM Corp. 2018, 2022 4-43


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Review questions (cont.)


6. Which of the following is part of the AutoAI process to build candidate pipelines?

a. Create a machine learning flow.

b. Create a deep learning flow.

c. Automated model selection.

d. Create SparkML flow type.

e. Hyperparameter optimization

f. A & B

g. C & E

h. All the above

Introduction to IBM Watson Machine Learning and AutoAI © Copyright IBM Corporation 2018, 2022

Figure 4-37. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 4-44


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty
Exercise: Building and deploying a regression analysis
model with Watson Machine Learning

Figure 4-38. Exercise: Building and deploying a regression analysis model with Watson Machine Learning

© Copyright IBM Corp. 2018, 2022 4-45


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 4. Introduction to IBM Watson Machine Learning and AutoAI

Uempty

Exercise • In this exercise, you perform regression analysis by using the scikit-
learn and the watson-machine-learning-client packages. You use
objectives the digits data set, which is one of the sample data sets in scikit-
learn. Then, you use IBM Watson Machine Learning SDK to create an
online deployment on the Machine Learning service on IBM Cloud.
• After completing this exercise, you should be able to:
ƒ Load a sample data set from scikit-learn.
ƒ Explore data.
ƒ Prepare data for training and evaluation.
ƒ Create a scikit-learn pipeline.
ƒ Train and evaluate a model.
ƒ Store a model in the Watson Machine Learning (WML) repository.
ƒ Deploy and score the model in IBM Cloud.

© Copyright IBM Corporation 2018, 2022

Figure 4-39. Exercise objectives

© Copyright IBM Corp. 2018, 2022 4-46


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Unit 5. Introduction to natural language


processing
Estimated time
00:30

Overview
This unit introduces Natural Language Processing. It covers key applications of NLP, basics
concepts and terminology, tools and services and NLP challenges.

© Copyright IBM Corp. 2018, 2022 5-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Unit objectives • Explain what natural language processing is.


• Identify NLP use cases.
• Explain basic NLP concepts and terminology
• List the tools and services for NLP.

© Copyright IBM Corporation 2019, 2022

Figure 5-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 5-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Topics • Natural language processing overview


• Natural language processing use cases
• Natural language processing basic concepts and terminology
• Natural language processing tools and services

© Copyright IBM Corporation 2019, 2022

Figure 5-2. Topics

© Copyright IBM Corp. 2018, 2022 5-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty
5.1. Natural language processing overview

© Copyright IBM Corp. 2018, 2022 5-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Natural language
processing overview

Figure 5-3. Natural language processing overview

© Copyright IBM Corp. 2018, 2022 5-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

What is natural language processing


• NLP is the study of the computational treatment of natural (human) language.
• It enables machines to understand human communication to extract different information.
• Examples of NLP applications: Analysis of text in emails, human speech, social media, or
documents.
• NLP has its origins in machine translation from the 1950s.
• NLP advanced over the years by combining the power of artificial intelligence (AI),
computational linguistics, and computer science.

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-4. What is natural language processing

NLP stands for natural language processing. It is a subfield of computer science and AI concerned
with the processing human language by computers. It is one of the most important fields in
computer science in both industry and academia.
NLP enables machines to understand human communication to extract different information.
Examples of NLP applications include analysis of text in emails, human speech, social media, or
documents.
NLP has its origins in machine translation from the 1950s.
The first machine translation was from English to Russian and vice versa, but with poor and
inaccurate results.
Machine translation and other NLP applications advanced over the years by combining the power
of artificial intelligence (AI), computational linguistics, and computer science.

© Copyright IBM Corp. 2018, 2022 5-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Natural language processing applications


• Machine translation
• Information retrieval: Search engines
• Spell checkers
• Natural language assistants

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-5. Natural language processing applications

Here are the most popular NLP tasks:


• Machine translation: Automatically translating one language to another
• Information retrieval: Search engines, such as Google and Bing
• Spell checkers
• Natural language assistants, such as Siri and Alexa

© Copyright IBM Corp. 2018, 2022 5-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Natural language processing challenges


• Domains: Higher accuracy for specific domains compared to generic domains.
• Language: English gets the most attention because it is an international language.
• Medium: Processing speech is more difficult than processing text.
• You can understand your NLP problem by focusing on the following areas:
ƒ Become familiar with your data.
ƒ Understand the challenges of your particular use case.
ƒ Review the state-of-the-art solutions and technologies for similar problems.

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-6. Natural language processing challenges

There are always some challenges that need to be tackled for any case. In NLP, here are the most
popular challenges:
• Domains: Higher accuracy for specific domains compared to generic domains.
• Language: English gets the most attention because it is an international language.
• Medium: Processing speech is more difficult than processing text.
To resolve some of these challenges, you must become familiar with your data and understand
the challenges of your particular use case. Think about how you will acquire the data and how to
validate its quality. Think about the deployment of your solution and how you are planning to
cover all these points.
Finally, review the state-of-the-art solutions and technologies for similar problems and how these
issues were resolved.
References:
Course hero
https://www.coursehero.com/file/p3q1s78/Language-English-gets-the-most-attention-because
-it-is-an-international-language/

© Copyright IBM Corp. 2018, 2022 5-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty
5.2. Natural language processing use cases

© Copyright IBM Corp. 2018, 2022 5-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Natural language
processing use
cases

Figure 5-7. Natural language processing use cases

© Copyright IBM Corp. 2018, 2022 5-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Natural language processing use cases


Information extraction
• Goal: Parse the input text to extract valuable output.
ƒ Examples: Entity extraction, relation identification extraction, text summarization
• Unstructured text: Dynamic structure (for example emails, newspaper articles, and user
reviews).
ƒ Parse unstructured text, identify important mentions and their relations, and extract valuable output
into structured text (defined structure).
Text summarization
• Goal: Shorten or summarize long pieces of text.

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-8. Natural language processing use cases

NLP technology can be used to extract information from unstructured text such as emails,
newspaper articles, and user reviews into structured text.
Entity extraction refers to extracting entities from the text such as organizations, people, and
locations. For example, the World Health Organization, IBM, Sara, John, Paris, US.
Relation extraction refers to identifying the relationship between entities, for example, “Abraham
Lincoln was a US president”; “Ginni Rometty is the CEO of IBM”.
Text summarization refers to the technique of shortening long pieces of text. Automatic text
summarization is a common use case in machine learning and natural language processing.
Structured text mostly takes the form of tables or values in a structured form.
The goal of information extraction is to parse the incoming text, identify important mentions and
their relations, and extract valuable output into structured text. Doing so can be used to automate
the process of reading articles and passages to convert this information into a structured format.
Computer systems can then manage this information and take proper actions.

© Copyright IBM Corp. 2018, 2022 5-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Natural language processing use cases (cont.)


Sentiment analysis
• The process of identifying emotions or opinions that are expressed in user input.
• This analysis is used in marketing, retention plans, and emotional intelligence for chatbots.

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-9. Natural language processing use cases (cont.)

Sentiment analysis is the process of identifying emotions or opinions that are expressed in user
input.
Sentiment analysis answers various questions, such as how people feel about your product or
whether your customers are satisfied with your customer service.
It is used in marketing and retention plans, and emotional intelligence for chatbots, that is, it
enables chatbots to direct the conversation.
Machine learning algorithms brought many advances to this field and are still improving.

© Copyright IBM Corp. 2018, 2022 5-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Natural language processing use cases (cont.)


Question and answering
• Builds solutions that can answer questions that are
asked by humans in natural language.
ƒ Examples: Natural language questions used to retrieve
answers from forums; FAQ application; chatbots

Speech recognition
• Converts spoken language into text.
ƒ Example: Chatbot interactive talk; Internet of Things
(IoT) applications

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-10. Natural language processing use cases (cont.)

Question and answering


Building solutions that can answer questions that are asked by humans in natural language. A
question and answering system can be used for the following tasks:
• Retrieving answers from forums.
• Building a Frequently Asked Questions (FAQs) system.
• Training chatbots
Speech recognition is another use case that helps to advance the capabilities of many different
applications. It converts spoken language into text. It can be used in many applications in several
domains, such as having an interactive talk with a chatbot. It can also be used in Internet of
Things (IoT) applications.

© Copyright IBM Corp. 2018, 2022 5-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty
5.3. Natural language processing basic
concepts and terminology

© Copyright IBM Corp. 2018, 2022 5-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Natural language
processing basic
concepts and
terminology

Figure 5-11. Natural language processing basic concepts and terminology

This section introduces basic concepts and terminologies such as synonymy, polysemy,
hyponymy, and hypernymy. The taxonomy for similar concepts has applications in the education
and machine learning fields because they rely on word-sense disambiguation.

© Copyright IBM Corp. 2018, 2022 5-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Basic concepts and terminologies


• Synonyms: Words that are written differently but are similar in meaning.
ƒ Example: Clever and smart
• Antonyms: Words that have meanings that are opposite to each other.
ƒ Example: Clever and stupid
• Usage example: In information retrieval, you might want to expand the keywords search by
retrieving the synonyms of the query words.

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-12. Basic concepts and terminologies

Synonyms are words that are written differently but are similar in meaning. For example:
• Clever and smart
• Begin and start
• Beautiful and pretty
• Sad and unhappy
Antonyms are words that have meanings that are opposite to each other. For example:
• Clever and stupid
• Begin and end
• Beautiful and ugly
• Sad and happy
Usage example: In information retrieval, you might want to expand the keywords search by
retrieving the synonyms of the query words.

© Copyright IBM Corp. 2018, 2022 5-16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Basic concepts and terminologies (cont.)


Homonyms: Words that have the same written form but have unrelated meanings. There are
two types of homonyms:
• Homographs: Words that have the same written form. For example:
ƒ This answer is right.
ƒ The building is on the right side of the river.
ƒ You have the right to remain silent.
ƒ Come here right now.
• Homophones: Words that sound similar when spoken but have different meanings and
spellings. For example:
ƒ “left” and “lift”.
ƒ “right” and “write”.

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-13. Basic concepts and terminologies (cont.)

Homonyms are words that have the same written form but have unrelated meanings. There are
two types of homonyms:
• Homographs
• Homophones
Homographs are words that have the same written form. For example:
• This answer is right.
• The building is on the right side of the river.
• You have the right to remain silent.
• Come here right now.
Although the word right has the same written form in the examples, you notice the difference
between the meanings in each sentence.
Homophones are words that sound similar when spoken but have different meanings and
spellings. For example:
• “left” and “lift”.
• “right” and “write”.

© Copyright IBM Corp. 2018, 2022 5-17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Basic concepts and terminologies (cont.)


• Homonyms challenges:
ƒ How do you translate “right” so that it has the correct meaning?
ƒ How do you differentiate two words that sound similar when you convert speech to text?

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-14. Basic concepts and terminologies (cont.)

Homonyms introduce challenges into NLP operations such as machine translation and speech
recognition. How do you translate right so that it has the correct meaning? How do you
differentiate two words that sound similar when you convert speech to text?

© Copyright IBM Corp. 2018, 2022 5-18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Basic concepts and terminologies (cont.)


• Polysemy: Words that have the same written form and a related meaning. For example:
ƒ You must face your fear.
ƒ Her face is beautiful.
• Hyponymy: A word is a hyponym of another word if it represents a subclass of the other word.
For example:
ƒ Orange is a hyponym of fruit.
ƒ Yellow is a hyponym of color.

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-15. Basic concepts and terminologies (cont.)

Polysemy refers to words that have the same written form and related meaning. For example:
• You must face your fear.
• Her face is beautiful.
Hyponymy: A word is a hyponym of another word if it represents a subclass of the other word. For
example:
• Orange is a hyponym of fruit.
• Yellow is a hyponym of color.

© Copyright IBM Corp. 2018, 2022 5-19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Basic concepts and terminologies (cont.)


• Hypernymy: One word is the hypernym of another word if it represents a superclass of the
other word. For example:
ƒ Fruit is a hypernym of orange.
ƒ Color is a hypernym of yellow.
• Usage example: Comparing the semantic similarity.

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-16. Basic concepts and terminologies (cont.)

Hypernymy: One word is the hypernym of another word if it represents a superclass of the other
word. For example:
• Fruit is a hypernym of orange.
• Color is a hypernym of yellow.
Usage example: Comparing the semantic similarity.

© Copyright IBM Corp. 2018, 2022 5-20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty
5.4. Natural language processing tools and
services

© Copyright IBM Corp. 2018, 2022 5-21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Natural language
processing tools
and services

Figure 5-17. Natural language processing tools and services

© Copyright IBM Corp. 2018, 2022 5-22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Natural language processing tools and services


Open-source NLP tools:
• Apache OpenNLP: Provides tokenizers, sentence segmentation, part-of-speech tagging,
named entity extraction, chunking, parsing, co-reference resolution, and more.
• Stanford Core NLP: A suite of NLP tools that provide part-of-speech tagging, a named entity
recognizer, a co-reference resolution system, sentiment analysis, and more.
• Natural Language Toolkit (NLTK): A Python library that provides modules for processing text,
classifying, tokenizing, stemming, tagging, parsing, and more.
• WordNet: One of the most popular lexical databases for the English language. Supported by
various API and programming languages.

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-18. Natural language processing tools and services

There are many open source tools that you can use for NLP. For example:
• Open NLP that is based on Java. It provides many functions for text processing, such as
tokenizers, sentence segmentation, part-of-speech tagging, named entity extraction,
chunking, parsing, co-reference resolution, and more. For more information, see Apache
OpenNLP at https://opennlp.apache.org/
• Stanford Core NLP, which is written in Java. It is a suite of NLP tools that provide
part-of-speech tagging, a named entity recognizer, a co-reference resolution system,
sentiment analysis, and more. It supports many languages, such as English, German, French,
Arabic, Spanish, and Chinese. For more information, see
https://stanfordnlp.github.io/CoreNLP/.
• NLTK provides the same processes as the other NLP suites, but in the Python language. For
more information, see https://www.nltk.org/.
• WordNet is a popular lexical database that is used in research. There are many APIs and
languages that you can use to access WordNet. For example, you can make a call to retrieve a
synonym of a word. WordNet is available online and as an offline version that you can
download. For more information, see https://wordnet.princeton.edu/.
There are other libraries, such as Unstructured Information Management Architecture (UIMA).
IBM Watson uses UIMA to analyze unstructured data. The Apache Clinical Text Analysis and
Knowledge Extraction System (Apache cTAKES) is a UIMA-based system that is used to extract
information from medical records.

© Copyright IBM Corp. 2018, 2022 5-23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty
References:
Apache OpenNLP
https://opennlp.apache.org/
CoreNLP
https://stanfordnlp.github.io/CoreNLP/

© Copyright IBM Corp. 2018, 2022 5-24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Natural language processing tools and services (cont.)


Services:
• Examples: IBM Cloud, Microsoft Cloud (Azure), and Google Cloud
• IBM offers AI services through IBM Cloud.
• Examples of NLP services are:
ƒ Watson Natural Language Understanding for text classification, entity identification, relation
extraction, and emotion extraction.
ƒ Language Translator: Translates text from one language to another.
ƒ Watson Assistant: build conversational interface into an application (chatbot).

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-19. Natural language processing tools and services (cont.)

Instead of using low-level libraries, you can use many cloud services that accomplish high-level
NLP tasks, for example, IBM Cloud, Microsoft Cloud (Azure), and Google Cloud.
IBM offers its AI services through IBM Cloud.
Examples of NLP services are:
• Watson Natural Language Understanding for text classification, entity identification, relation
extraction, and emotion extraction.
• Language Translator: Translates text from one language to another
• Watson Assistant: build conversational interface into an application (chatbot).
You can rapidly build a complete NLP application by using these services.

© Copyright IBM Corp. 2018, 2022 5-25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Unit summary • Explain what natural language processing is.


• Identify NLP use cases.
• Explain basic NLP concepts and terminology
• List the tools and services for NLP.

© Copyright IBM Corporation 2019, 2022

Figure 5-20. Unit summary

© Copyright IBM Corp. 2018, 2022 5-26


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Review questions
1. Identifying opinions in a user input is a use case of:
a. Sentiment analysis
b. Classification
c. Chatbots
d. Translation

2. “Apple" is the …… of “fruit"


a. Synonym
b. Antonym
c. Hypernymy
d. Hyponymy

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-21. Review questions

© Copyright IBM Corp. 2018, 2022 5-27


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Review questions (cont.)


3. What are examples of information extraction?
a. Entities identification
b. Relation identification
c. Automatic summarization
d. All the above

4. True or False: Most Natural Language Processing (NLP) tasks work with structured data.

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-22. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 5-28


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Review answers
1. Email spam detection is a use case of:
a. Sentiment analysis
b. Classification
c. Chatbots
d. Translation

2. “Apple" is the …… of “fruit"


a. Synonym
b. Antonym
c. Hypernymy
d. Hyponymy

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-23. Review answers

© Copyright IBM Corp. 2018, 2022 5-29


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 5. Introduction to natural language processing

Uempty

Review answers (cont.)


3. What are examples of information extraction?
a. Entities identification
b. Relation identification
c. Automatic summarization
d. All of the above

4. True or False: Most Natural Language Processing (NLP) tasks work with structured data.

Introduction to natural language processing © Copyright IBM Corporation 2019, 2022

Figure 5-24. Review answers (cont.)

© Copyright IBM Corp. 2018, 2022 5-30


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Unit 6. Natural language processing


concepts and components
Estimated time
00:30

Overview
This unit covers natural language processing components, the NLP pipeline, natural language
understanding, natural language generation, information retrieval, and information extraction.

© Copyright IBM Corp. 2018, 2022 6-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Unit objectives • Define the NLP categories.


• Describe the NLP pipeline.
• Explain the challenges in natural language understanding (NLU).
• Explain the concepts of information retrieval and extraction.
• Describe sentiment analysis.

© Copyright IBM Corporation 2019, 2022

Figure 6-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 6-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Topics • Natural language processing categories


• Language ambiguities
• Natural language processing phases and pipeline
• Information retrieval
• Information extraction

© Copyright IBM Corporation 2019, 2022

Figure 6-2. Topics

© Copyright IBM Corp. 2018, 2022 6-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty
6.1. Natural language processing categories

© Copyright IBM Corp. 2018, 2022 6-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language
processing
categories

Figure 6-3. Natural language processing categories

© Copyright IBM Corp. 2018, 2022 6-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language processing categories


• Natural language understanding (NLU)
• Natural language generation (NLG)

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-4. Natural language processing categories

There are two categories of NLP:


• Natural language understanding (NLU): It is the NLP task of extracting insights from natural
language inputs.
• Natural language generation (NLG): it is the NLP task of building natural language outputs from
non-linguistic inputs.
Natural language exists in various media, such as text in documents, reports, or messages, or
speech.
The graphic in the slide shows that NLU is the NLP process that takes input text while NLG is the
NLP process that generates text as output.

© Copyright IBM Corp. 2018, 2022 6-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

NLU applications
• Unstructured to structured
• Question and answer system
• Sentiment analysis

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-5. NLU applications

NLU analyzes language to gain insights into the text. There are many examples of NLU
applications:
• Mapping a user’s unstructured input to a computer representation (structured data) and
relation extraction
• Question and answering system
• Sentiment analysis
The graphic in the slide shows an example of converting unstructured to structured data. The
input to the NLU system is natural language (unstructured text) and through the NLP process it is
converted to structured data (table).
References:
Natural Language Generation: An Overview
http://www.lacsc.org/papers/PaperA6.pdf
Understanding Natural Language Understanding
https://nlp.stanford.edu/~wcmac/papers/20140716-UNLU.pdf

© Copyright IBM Corp. 2018, 2022 6-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

NLG applications
• Machine translation
• Text summarization
• Weather forecasting system

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-6. NLG applications

Here are some NLG application examples:


• Translator.
• Text summarization.
• Weather Forecasting Systems, which compile graphical weather maps representations and
interpret the numbers that come from the prediction system. By using NLG, you can transform
this information into natural language.
References:
Watson Language Translator
https://www.ibm.com/cloud/watson-language-translator
Natural Language GenerationScope, Applications and Approaches
http://www.academia.edu/3879518/Natural_Language_Generation_Scope_Applications_and_A
pproaches

© Copyright IBM Corp. 2018, 2022 6-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty
6.2. Language ambiguities

© Copyright IBM Corp. 2018, 2022 6-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Language
ambiguities

Figure 6-7. Language ambiguities

© Copyright IBM Corp. 2018, 2022 6-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Language ambiguities
• Lexical ambiguity: A primitive level, such as at the word level
• Verb versus noun:
ƒ “We will dance all night.”
ƒ “This is the salsa dance.”
ƒ “John will go to work.”
ƒ “His uncle left him millions in his will.”

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-8. Language ambiguities

Building applications with NLP processes is not a trivial task. Natural language includes many
ambiguities, such as a lexical ambiguity, which is a primitive level, such as at the word level.
Two examples:
• The word dance can be a verb (“We will dance all night.”) or a noun (“This is the salsa dance.”).
• The word will can be a helping verb to indicate an action in the future (“John will go to work”)
or a noun (“His uncle left him millions in his will.”).

© Copyright IBM Corp. 2018, 2022 6-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Language ambiguities (cont.)


• Syntactic-level ambiguity: A sentence that can be parsed in various ways.
ƒ Example: “She pointed at the guy with the umbrella.”
• Anaphora ambiguity occurs when it is not clear which one is the antecedent noun that a
pronoun replaces because more than one possible antecedent exists.
ƒ Example: “When Mary invited Ann to play, she did not know that she would be late”.

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-9. Language ambiguities (cont.)

Here are two more types of language ambiguity:


• Syntactic-level ambiguity: A sentence that can be parsed in various ways. For example: “She
pointed at the guy with the umbrella.” Did she use her umbrella to point at the guy or did she
point at the guy who is carrying an umbrella?
• Anaphora is an expression for which the interpretation depends on another expression that
was previously introduced. The referring term is called anaphor and it is usually a pronoun.
The pronoun takes the place of a noun but, to avoid ambiguity, the pronoun must refer clearly
to the noun that the pronoun replaces.
• An anaphora ambiguity occurs when more than one possible antecedent exists. For example:
“When Mary invited Ann to play she did not know that she would be late.” Is the first “she”
replacing Mary or Ann? Who did not know? Is the second “she” replacing Mary or Ann? Who
would be late?
References:
Syntactic ambiguity
https://en.wikipedia.org/wiki/Syntactic_ambiguity
Anaphora (linguistics)
https://en.wikipedia.org/wiki/Anaphora_(linguistics)

© Copyright IBM Corp. 2018, 2022 6-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty
6.3. Natural language processing phases and
pipeline

© Copyright IBM Corp. 2018, 2022 6-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language
processing phases
and pipeline

Figure 6-10. Natural language processing phases and pipeline

© Copyright IBM Corp. 2018, 2022 6-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language processing phases


• Breaks down the text paragraphs, sentences, and words.
Morphological Analysis/
• Analysis is done for identification and description of the structure of words.
Lexical Analysis • Techniques used: stop word removal, tokenization, stemming, and lemmatization.

• Checks grammar, arrangements of words, and the relationship between the words.
Syntactic Analysis • Techniques used: dependency parsing, and part of speech (POS) tagging.

• Extracts meaningful information from the text.


Semantic Analysis • Rejects and ignores the sentences that do not make sense.

• Studies the underlying meaning of a spoken or written text as it considers the social
Discourse Integration and historical contexts.
• Helps in studying the whole text.

• Interprets the text by using information from the previous steps.


Pragmatic Analysis • Understands the communicative and social content.

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-11. Natural language processing phases

The NLP five phases or stages are:


Morphological Analysis
Morphological analysis is a field of linguistics that studies the structure of words. It identifies how a
word is produced by using morphemes. The morpheme is the smallest element of a word that has
grammatical function and meaning. It is a meaningful morphological unit of a language that
cannot be further divided.
Also, this phase is called lexical analysis, which deals with the study at the level of words regarding
their lexical meaning and part-of-speech. This level of linguistic processing uses a language's
lexicon. Lexicon of a language is the collection of words and phrases in that language. The lexical
analysis divides the text into paragraphs, sentences, and words. Lexical normalization, which is
the process of converting or transforming a nonstandard text to a standard register, is performed.
Lexical normalization includes techniques such as:
• Stop word removal (removing for example ‘and’, ‘of’, ‘the’ from text)
• Tokenization (breaking the text into sentences or words)
• Word tokenizer
• Sentence tokenizer
• Tweet tokenizer
• Stemming (removing ‘ing’, ‘es’, ‘s’ from the tail of the words)
• Lemmatization (converting the words to their base forms)

© Copyright IBM Corp. 2018, 2022 6-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty
Syntactic Analysis
Syntactic analysis is the analysis that provides the logical meaning of a sentence or parts of that
sentence. It is the process of analyzing natural language with the rules of formal grammar.
Grammatical rules are applied to categories and groups of words, not to individual words.
Syntactic Analysis is used to check grammar, arrangements of words, and the interrelationship
between the words.
Example: “Mumbai goes to the Sara”. This sentence does not make sense, so this sentence is
rejected by a syntactic analyzer.
Syntactical parsing involves the analysis of words in the sentence for grammar. Dependency
grammar and part of speech (POS) tags are the important attributes of text syntactic.
Some of the techniques that are used in this phase are:
• Dependency Parsing
• Part of Speech (POS) tagging
Semantic Analysis
Semantic analysis retrieves the possible meanings of a sentence that is clear and semantically
correct. It is the process of retrieving meaningful insights from text.
Discourse Integration
Discourse integration refers to the context of a sentence or word. The meaning of a sentence
depends on the meaning of the sentence just before it. In addition, it also brings about the
meaning of the immediately succeeding sentence.
For example, the word “that” in the sentence “He wanted that” depends upon the prior discourse
context.
Pragmatic Analysis
Pragmatic analysis is the study of meanings in a language. In involves the process of extraction of
insights from the text. Through Pragmatic Analysis, what was described is reinterpreted by what it
was meant. It derives the various aspects of language that require real-world knowledge. It
means to abstract the meaningful use of language in situations. In this analysis, the focus is
always on what was said is reinterpreted on what is intended.
For example, the sentence “Please crack the door open” does not mean to break the door but to
open it a small amount.

© Copyright IBM Corp. 2018, 2022 6-16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty
References:
Phases in Natural Language Processing
https://padhaitime.com/Natural-Language-Processing/Phases-in-NLP
Stages of Natural Language Processing
https://byteiota.com/stages-of-nlp/
The 5 Phases of Natural Language Processing
https://www.optisolbusiness.com/insight/the-5-phases-of-natural-language-processing
Natural Language Processing Step by Step Guide
https://www.analyticsvidhya.com/blog/2021/05/natural-language-processing-step-by-step-gui
de/#h2_6

© Copyright IBM Corp. 2018, 2022 6-17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language processing pipeline


• A pipeline is a way to design a program in which the output of one module feeds into the input
of the next module.
• Using the NLP pipeline divides the tasks of NLU, which makes NLU less complex.
• For example, use NLP pipeline to understand the following sentence:
ƒ “Yes, I got the invitation, and I will happily attend your party in London.”

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-12. Natural language processing pipeline

When you work on an NLP task like machine translation, you must perform a set of processes and
activities. This set of processes is the NLP pipeline.
A pipeline is a process for designing a program in which the output of one module feeds into the
input of the next module. You use the pipeline to break down the complexity of the NLP task into a
smaller set of less complicated tasks. There are no strict rules for the activities that must be done
in the pipeline.
The following slides, explore some of these activities by using the following example:
“Yes, I received your invitation, and I will happily attend your party in London.”
This statement is understandable by a human but not a computer. We use the pipeline to walk
through each stage to analyze the statement.
Reference:
CoreNLP Pipelines
https://stanfordnlp.github.io/CoreNLP/pipelines.html

© Copyright IBM Corp. 2018, 2022 6-18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language processing pipeline


Sentence segmentation

Word tokenization

Stemming

Lemmatization

Stop words removal

Dependency Parsing (DP)

Part of speech (POS) tagging

Named entity recognition (NER)

Chunking
Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-13. Natural language processing pipeline

NLP uses pipelines to read, decipher, and understand human languages. The slide shows the
prime processes of the NLP pipelines.
References:
Preprocessing steps in Natural Language Processing (NLP)
https://www.educative.io/answers/preprocessing-steps-in-natural-language-processing-nlp
How to build an NLP pipeline
https://www.wikitechy.com/tutorial/nlp/how-to-build-an-nlp-pipeline

© Copyright IBM Corp. 2018, 2022 6-19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language processing pipeline (cont.)


1. Sentence segmentation:
• Detect sentence boundaries.
• There are two sentences in the example that are separated by the conjunction “and”:
ƒ “Yes, I got the invitation, and I will happily attend your party in London.”
• Apply this process to the example:
ƒ “Yes, I got the invitation.”
ƒ “I will happily attend your party in London.”

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-14. Natural language processing pipeline (cont.)

Sentence segmentation focuses on finding the boundaries of sentences in text, that is, where the
sentence starts and ends. This is not an easy task to accomplish due to the possible ambiguity
that is caused by punctuation marks.
For example, a period might indicate the end of a sentence, but it might also indicate an
abbreviation, a decimal point, or an email address.
Assume that the two sentences here are separated by the conjunction “and”, so the result of this
stage is the following sentences:
• “Yes, I received your invitation.”
• “I will happily attend your party in London.”
Reference:
Sentence boundary disambiguation
https://en.wikipedia.org/wiki/Sentence_boundary_disambiguation

© Copyright IBM Corp. 2018, 2022 6-20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language processing pipeline (cont.)


2. Word Tokenization:
ƒ Breaks a sentence into tokens.
ƒ Tokenization uses delimiters, for example, a space ” “.
ƒ Apply tokenization to the example:
í First sentence: “Yes””,” “I” “got” “the” “invitation”
í Second sentence: “I” “will” “happily” “attend” “your” “party” “in” “London”

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-15. Natural language processing pipeline (cont.)

Tokenization is a basic process that breaks a sentence into a group of words, punctuation,
numbers, and alphanumerics that are called tokens. The tokenization can be done on multiple
delimiters. Assume in the example that you use the white space as delimiter and apply
tokenization to the example:
First sentence: “Yes””,” “I” “received” “your” “invitation”
Second sentence: “I” “will” “happily” “attend” “your” “party” “in” “London”
White space is a standard delimiter but is not sufficiently useful by itself. For example,
segmenting “New York” into “New” and “York” might introduce ambiguity because they both
refer to a state, so you should preserve the space in-between.

Note

Sentence segmentation, tokenization, and other activities in the pipeline might also differ
depending on the language. For example, you cannot use the same English tokenizer with the
Japanese language.

© Copyright IBM Corp. 2018, 2022 6-21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language processing pipeline (cont.)


3. Stemming:
ƒ Removes the prefixes and suffixes to obtain the root word.
ƒ The stem does not have to match the morphological root of the word. For example, “Studies”
stemmed to “Studi”.
ƒ The most popular English stemming algorithm is the Porter's algorithm (Porter, 1980).
ƒ Example:
í List of words: Affection, Affects, Affecting, Affected, Affecting
í Root word: Affect+
ƒ Apply stemming to the example:
í First sentence: “Yes””,” “I” “got” “the” “invitation”
“invitation” => “invit”
í Second sentence: “I” “will” “happily” “attend” “your” “party” “in” “London”
“happily” => “happi”

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-16. Natural language processing pipeline (cont.)

In the stemming step, the prefixes and suffixes are removed to obtain the root word.
Stemming chops words without knowing the context of the word in sentences. It might create the
nonexistence meaning of a word. For Example: “Studies” => “Studi”, "troubled" => "troubl".
Stemming is preferred when the meaning of the word is not important for analysis, for example
spam detection. Lemmatization is recommended when the meaning of the word is important for
analysis, for example, Question & Answer system.
References:
Preprocessing steps in Natural Language Processing (NLP)
https://www.educative.io/answers/preprocessing-steps-in-natural-language-processing-nlp
What is Stemming and Lemmatization in NLP?
https://www.analyticssteps.com/blogs/what-stemming-and-lemmatization-nlp

© Copyright IBM Corp. 2018, 2022 6-22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Porter stemmer

Step Number Rule Example

sses → ss glasses → glass


ies → I parties → parti
1
ss → ss loss → loss
s→ø hats → hat

talking → talk
ing → ø
2 discovered → discover
ed → ø

ational → ate operational → operate


3 izer → ize recognizer → recognize
ator → ate collaborator → collaborate

al → ø
electrical → electric
able → ø
4 doable → do
ate → ø
investigate → investing

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-17. Porter stemmer

This table demonstrates some of the rules of the Porter stemmer.

© Copyright IBM Corp. 2018, 2022 6-23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language processing pipeline (cont.)


4. Lemmatization:
ƒ Groups together different inflected forms of a word into a base word called lemma.
ƒ Example:
í List of words: going, gone, went
í Lemma: go
ƒ Apply lemmatization to the example:
í First sentence: “Yes””,” “I” “got” “the” “invitation”
“got” => “get”

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-18. Natural language processing pipeline (cont.)

An inflected form of a word has a changed spelling or ending that shows the way it is used in
sentences: "Finds" and "found" are inflected forms of "find."
Lemmatization groups different inflected forms of a word into a base word called lemma. For
example,
List of words: going, gone, went
Lemma: go
References:
Preprocessing steps in Natural Language Processing (NLP)
https://www.educative.io/answers/preprocessing-steps-in-natural-language-processing-nlp
What is Stemming and Lemmatization in NLP?
https://www.analyticssteps.com/blogs/what-stemming-and-lemmatization-nlp

© Copyright IBM Corp. 2018, 2022 6-24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language processing pipeline (cont.)


5. Stop words removal:
ƒ Removes a set of commonly used words that do not add much meaning to the sentence.
ƒ Allows applications to focus on the important words instead.
ƒ Example:
í Removing ‘and’, ‘of’, ‘the’ from text
ƒ Apply stop word removal to the example:
í First sentence: “Yes””,” “I” “got” “the” “invitation”
Removing the word “the”

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-19. Natural language processing pipeline (cont.)

Stop words are the words in any language that do not add much meaning to a sentence. Stop
words can safely be ignored without sacrificing the meaning of the sentence. For example, in
English, “the”, “is” and “and”, are examples of stop words. In NLP and text mining applications,
stop words removal eliminates unimportant words so that applications can focus on the important
words instead.
A list of English stop words can be found at https://www.ranks.nl/stopwords
References:
Preprocessing steps in Natural Language Processing (NLP)
https://www.educative.io/answers/preprocessing-steps-in-natural-language-processing-nlp
Stopwords Lists
https://www.ranks.nl/stopwords

© Copyright IBM Corp. 2018, 2022 6-25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language processing pipeline (cont.)


6. Dependency Parsing (DP):
ƒ Examines the dependencies between the phrases of a sentence to determine its grammatical
structure.
ƒ Based on the assumption that there is a direct relationship between each linguistic unit in a sentence.
ƒ The relationships between each linguistic unit, or phrase, in the sentence are expressed by directed
arcs.
ƒ Example: The diagram explains the sentence’s dependence structure.
Dependency tag Description

root The root of the tree

nsubj nominal topic

dobj direct object

det determiner

nmod nominal modifier

case case-marking

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-20. Natural language processing pipeline (cont.)

Dependency Parsing (DP) is the process of examining the dependencies between the phrases of a
sentence to determine its grammatical structure. A sentence is divided into sections. The process
assumes that there is a direct relationship between each linguistic unit in a sentence. These
hyperlinks are called dependencies.
The example in the slide shows a diagram that explains the sentence’s dependence structure.
In a written dependency structure, the relationships between each linguistic unit, or phrase, in the
sentence are expressed by directed arcs. In the example, the root of the tree “prefer” varies the
pinnacle of the preceding sentence, as labelled in the diagram. Relations among the words are
illustrated above the sentence with directed, labeled arcs from heads to dependents. A root node
explicitly marks the root of the tree, the head of the entire structure.
A dependence tag indicates the relationship between linguistic units. For example, the word
“flight” changes the meaning of the noun “Denver.” As a result, you might identify a dependence
flight -> Denver, where flight is the pinnacle or head and Denver is the kid or dependent. It is
represented by nmod, which stands for the nominal modifier.

© Copyright IBM Corp. 2018, 2022 6-26


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty
The dependency tags that are used in the example are:
• nominal subject (nsubj): nominal, which is the syntactic subject and the proto-agent of a
clause.
• direct object of a verb (dobj): noun phrase, which is the (accusative) object of the verb.
• relation determiner (det): holds between a nominal head and its determiner.
• nominal modifier (nmod): The nmod relation is used for nominal dependents of another noun
or noun phrase and functionally corresponds to an attribute, or genitive complement.
• Case: The case relation is used for any case-marking element, which is treated as a separate
syntactic word (including prepositions, postpositions, and clitic case markers). Case-marking
elements are treated as dependents of the noun that they attach to or introduce.
References:
Dependency Parsing
https://www.analyticsvidhya.com/blog/2021/12/dependency-parsing-in-natural-language-proc
essing-with-examples/
Dependency Parsing
https://web.stanford.edu/~jurafsky/slp3/14.pdf
Universal Dependency Relations
https://universaldependencies.org/u/dep/
CoreNLP - Online tool to apply dependency parsing
https://corenlp.run/

© Copyright IBM Corp. 2018, 2022 6-27


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language processing pipeline (cont.)


6. Dependency Parsing (DP) (cont.):
ƒ Apply dependency parsing (DP) to the example “Yes, I got the invitation. I will happily attend your
party in London”
Dependency tag Description

nsubj nominal topic

punct punctuation

discourse discourse element

det determiner

obj the object of a verb

advmod adverbial modifier

aux auxiliary

nmod:poss possessive nominal modifier

case case-marking

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-21. Natural language processing pipeline (cont.)

The slide shows the results of submitting the example “Yes, I got the invitation. I will happily
attend your party in London”.
The dependency tags that are used in the example are:
• nominal subject (nsubj): nominal, which is the syntactic subject and the proto-agent of a
clause.
• punctuation (punct): It is used for any piece of punctuation.
• discourse: It is used for interjections and other discourse particles and elements, which are
not clearly linked to the structure of the sentence, except in an expressive way.
• obj: The object of a verb is the second most core argument of a verb after the subject.
Typically, it is the noun phrase that denotes the entity acted upon or which undergoes a
change of state or motion (the proto-patient).
• advmod: An adverbial modifier of a word is a (non-clausal) adverb or adverbial phrase that
serves to modify a predicate or a modifier word.
• aux: An auxiliary of a clause is a function word that is associated with a verbal predicate that
expresses categories such as tense, mood, aspect, voice or evidentiality. It is often a verb
(which might have non-auxiliary uses) but many languages have nonverbal TAME markers,
which are also treated as instances of aux.
• nmod:poss It is used for a nominal modifier, which occurs before its head in the specifier
position that is used for ‘s possessives.
• Case: The case relation is used for any case-marking element, which is treated as a separate
syntactic word (including prepositions, postpositions, and clitic case markers). Case-marking
elements are treated as dependents of the noun that they attach to or introduce.

© Copyright IBM Corp. 2018, 2022 6-28


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty
References:
CoreNLP - Online tool to apply dependency parsing
https://corenlp.run/
Universal Dependency Relations
https://universaldependencies.org/u/dep/

© Copyright IBM Corp. 2018, 2022 6-29


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language processing pipeline (cont.)


7. Part of speech (POS) tagging:
ƒ Tags words in correspondence with a particular part of speech (for example, nouns, verb, adjectives,
pronouns) depending on the definition of the word and its context.
ƒ POS helps the computer to understand language and grammar and derive meaning from the input
sentence.
ƒ The most famous data set is the Penn Treebank project.
ƒ Apply POS tags to the example: Tag Description
UH Interjection
í First sentence:
“yes/UH” “,/,” ”I/PRP” “got/VBD” “the/DT” “invitation/NN” “,/,” DT Determiner
VBD Verb, past tense
í Second sentence:
Noun, singular or
“I/PRP” “will/MD” “happily/RB” “attend/VB” “your/PRP$” “party/NN” NN
mass
“in/IN” “London/NNP” MD Modal
RB Adverb
VB Verb, base form
PRP Personal pronoun

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-22. Natural language processing pipeline (cont.)

POS tagging is the process of tagging each token with its grammatical representation, such as
noun, verb, or adjective.
POS helps the computer to understand language and grammar and derive meaning from the input
sentence.
In the example, the data set is English grammar, so according to the part of speech that are
defined, the objective is to label each token by its proper grammar value, that is, the
corresponding part of speech.
POS helps the computer to understand language and grammar and derive meaning from the input
sentence. Many human-annotated data sets are publicly available. One of the most popular data
sets is the one used by the Penn Treebank project.
References:
Part-of-speech tagging
https://en.wikipedia.org/wiki/Part-of-speech_tagging
Stanford Log-linear Part-Of-Speech Tagger
https://nlp.stanford.edu/software/tagger.shtml
Alphabetical list of part-of-speech tags used in the Penn Treebank Project:
https://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html

© Copyright IBM Corp. 2018, 2022 6-30


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language processing pipeline (cont.)


8. Named Entity Recognition (NER):
ƒ Classifies named entities that are mentioned in the text into categories such as “People,” “Locations,”
“Organizations,” and so on.
ƒ Example:
í Text: “Google CEO Sundar Pichai resides in New York.”
í Named entity recognition:
“Google” –> Organization
“Sundar Pichai” –> Person
“New York” –> Location
ƒ Apply named entity recognition (NER) to the example:
í Second sentence: “I” “will” “happily” “attend” “your” “party” “in” “London”
“London” –> Location

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-23. Natural language processing pipeline (cont.)

Named Entity Recognition (NER) is the process of detecting the named entity such as person
name, movie name, organization name, or location.
References:
Preprocessing steps in Natural Language Processing (NLP)
https://www.educative.io/answers/preprocessing-steps-in-natural-language-processing-nlp
How to build an NLP pipeline
https://www.wikitechy.com/tutorial/nlp/how-to-build-an-nlp-pipeline

© Copyright IBM Corp. 2018, 2022 6-31


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Natural language processing pipeline (cont.)


9. Chunking :
ƒ Collects individual pieces of information and groups them into larger units.
ƒ Helps to extract the important words from lengthy descriptions.
ƒ Example to identify nouns in a sentence:
í Text: “I had burgers and pastries for breakfast.”
í Chunk noun phrases: “burgers”, “pastries”, “breakfast”
ƒ Useful to group data within specific categories
í Group fruits with certain nutritional properties: “fruits rich in proteins” and “fruits rich in vitamins”
í Group cars with similar features: “cars with automatic gear” and “cars with manual gear”

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-24. Natural language processing pipeline (cont.)

Chunking refers to the process of taking individual pieces of information and grouping them into
larger units. Chunking can be used to identify part of speech and short phrases present in a
sentence.
By grouping each data point into a larger whole, you can, for example, identify and group the part
of speech noun, verb, adjective, adverb, preposition, conjunction, pronoun, and interjection and
also short phrases formed by including any of these part of speech.
When you have loads of descriptions or modifications around a particular word or phrase of your
interest, you use chunking to grab the required phrase or word alone, ignoring the rest around it.
Hence, chunking paves a way to group the required phrases and exclude all the modifiers around
them, which are not necessary for analysis.
Chunking is used in NLP applications, for example, to group fruits of a specific category, such as
fruits rich in proteins, fruits rich in vitamins. Another example, chunking can also be used to group
cars with similar features. For example, cars with automatic gear in one group and cars with
manual gear into another group.
References:
Preprocessing steps in Natural Language Processing (NLP)
https://www.educative.io/answers/preprocessing-steps-in-natural-language-processing-nlp
How to build an NLP pipeline
https://www.wikitechy.com/tutorial/nlp/how-to-build-an-nlp-pipeline
What is Chunking in Natural Language processing?
https://www.analyticsvidhya.com/blog/2021/10/what-is-chunking-in-natural-language-processi
ng/

© Copyright IBM Corp. 2018, 2022 6-32


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty
6.4. Information retrieval

© Copyright IBM Corp. 2018, 2022 6-33


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Information
retrieval

Figure 6-25. Information retrieval

© Copyright IBM Corp. 2018, 2022 6-34


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Information retrieval
• Information retrieval is the process of accessing and retrieving the most appropriate
information from text based on a particular query in natural language that is submitted by the
user, with the help of context-based indexing or metadata.
• An information retrieval system searches a collection of natural language documents with
the goal of retrieving exactly the set of documents that matches a user’s question.
• Information retrieval is the foundation of many search engines. .

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-26. Information retrieval

Information retrieval (IR) is the process of accessing and retrieving the most appropriate
information from text based on a particular query in natural language that is submitted by the
user, with the help of context-based indexing or metadata.
Google Search is the most popular example of an information retrieval application.
An information retrieval system searches a collection of natural language documents with the goal
of retrieving exactly the set of documents that matches a user’s question. They have their origin in
library systems.
These systems assist users in finding the information that they require but it does not attempt to
deduce or generate answers. They provide information about the existence and location of
documents that might contain the required information. The documents that satisfy the user’s
requirement are called relevant documents. A perfect information retrieval system retrieves only
relevant documents.
Reference:
Step by Step Guide to Master NLP – Information Retrieval
https://www.analyticsvidhya.com/blog/2021/06/part-20-step-by-step-guide-to-master-nlp-info
rmation-retrieval/

© Copyright IBM Corp. 2018, 2022 6-35


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Information retrieval system steps

Indexing the collection of documents.

Transforming the query in the same way as the document content is represented.

Comparing the description of each document with that of the query.

Listing the results in order of relevancy.

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-27. Information retrieval system steps

A user who needs information formulates a request in the form of a query in natural language.
After that, the IR system returns output by retrieving the relevant documents, about the required
information. The IR system accomplishes the goal by performing the following steps:
1. Indexing the collection of documents.
2. Transforming the query in the same way as the document content is represented.
3. Comparing the description of each document with that of the query.
4. Listing the results in order of relevancy.
References:
Step by Step Guide to Master NLP – Information Retrieval
https://www.analyticsvidhya.com/blog/2021/06/part-20-step-by-step-guide-to-master-nlp-info
rmation-retrieval/

© Copyright IBM Corp. 2018, 2022 6-36


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Information retrieval systems main processes


• Information retrieval systems consist of mainly two processes:

• The process of selecting terms to represent a text.


• Tasks:
Indexing - Tokenization of string
- Removing frequent words
- Stemming

• The process of finding a measure of similarity between two text


representations
• The relevance of a document is computed based on the
Matching following parameters:
- Term frequency (TF)
- Inverse Document Frequency (IDF)
- TF-IDF score

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-28. Information retrieval systems main processes

Information retrieval systems consist of mainly two processes:


• Indexing
• Matching
Indexing is the process of selecting terms to represent a text.
Indexing involves:
• Tokenization of string
• Removing frequent words
• Stemming
Two common Indexing Techniques:
• Boolean Model
• Vector space model
Matching is the process of finding a measure of similarity between two text representations.
The relevance of a document is computed based on the following parameters:
Reference:
Step by Step Guide to Master NLP – Information Retrieval
https://www.analyticsvidhya.com/blog/2021/06/part-20-step-by-step-guide-to-master-nlp-info
rmation-retrieval/

© Copyright IBM Corp. 2018, 2022 6-37


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Term Frequency and Inverse Document Frequency


• Term Frequency (TF): the number of times a term appears in a document.
ƒ TF(i, j) = (count of ith term in jth document)/(total terms in jth document)
• Inverse Document Frequency (IDF): a measure of the general importance of the term.
ƒ ID (i) = (total no. of documents)/(no. of documents containing ith term)
• TF-IDF score: is a combination of two weighting methods for information retrieval to
determine how important a term is.
ƒ TF-IDF Score (i, j) = TF * IDF

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-29. Term Frequency and Inverse Document Frequency

The relevance of a document is computed based on the following parameters:


1. TF. It stands for Term Frequency, which is the number of times a given term appears in that
document.
• TF (i, j) = (count of ith term in jth document)/(total terms in jth document)
2. IDF. It stands for Inverse Document Frequency, which is a measure of the general importance
of the term.
• IDF (i) = (total no. of documents)/(no. of documents containing ith term)
3. TF-IDF Score (i, j) = TF * IDF
Reference:
Step by Step Guide to Master NLP – Information Retrieval
https://www.analyticsvidhya.com/blog/2021/06/part-20-step-by-step-guide-to-master-nlp-info
rmation-retrieval/

© Copyright IBM Corp. 2018, 2022 6-38


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty
6.5. Information extraction

© Copyright IBM Corp. 2018, 2022 6-39


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Information
extraction

Figure 6-30. Information extraction

© Copyright IBM Corp. 2018, 2022 6-40


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Information extraction
• Refers to the automatic extraction of structured information from unstructured or semi-
structured text.
• Examples of applications where information extraction is used:
ƒ Entities and relation identification
ƒ Sentiment analysis

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-31. Information extraction

Information extraction refers to the automatic extraction of structured information from


unstructured or semi-structured text.
For example, information extraction is used in the following applications:
• Entities and relation identification
• Sentiment analysis

© Copyright IBM Corp. 2018, 2022 6-41


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Information extraction (cont.)


• Entities and relation identification

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-32. Information extraction (cont.)

As shown in this slide, “Nobel Prize” and “Wilhelm Conrad Rontgen” are identified as entities. The
relationship is identified as awarded, which indicates the relationship between Wilhelm and the
Nobel Prize.

© Copyright IBM Corp. 2018, 2022 6-42


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Information extraction (cont.)


Sentiment analysis:
• Detects user’s opinions in text.
• Used in the field of chatbots, social media analysis, and others.
• Examples:
ƒ “Their service is amazing” is a positive sentiment.
ƒ “The quality of food in this restaurant is terrible” is a negative sentiment.
ƒ “I am going to school” is a neutral sentiment.

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-33. Information extraction (cont.)

Sentiment analysis is the process of identifying emotions or opinions that are expressed in user
input. It is used heavily in the fields of chatbots and social media analysis. It is also used in
marketing because it captures a user’s opinion about a particular product or service so that an
organization can take corrective action to keep the user satisfied.
Examples:
• “Their service is amazing” is a positive sentiment.
• “The quality of food in this restaurant is terrible” is a negative sentiment.
• “I am going to school” is a neutral sentiment.

© Copyright IBM Corp. 2018, 2022 6-43


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Unit summary • Define the NLP categories.


• Describe the NLP pipeline.
• Explain the challenges in natural language understanding (NLU).
• Explain the concepts of information retrieval and extraction.
• Describe sentiment analysis.

© Copyright IBM Corporation 2019, 2022

Figure 6-34. Unit summary

© Copyright IBM Corp. 2018, 2022 6-44


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Review questions
1. The technique that is used to group together different inflected forms of a word into a base
word is called:
a. Stemming
b. Dependency Parsing (DP)
c. Chunking
d. Lemmatization

2. What is the process of labeling tokens with their grammatical label?


a. Word tokenization
b. POS tagging
c. Semantic analysis
d. Stemming

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-35. Review questions

© Copyright IBM Corp. 2018, 2022 6-45


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Review questions (cont.)

3. True or False: For any NLP task, you must apply every step in the NLP pipeline.
4. True or False: Sentiment analysis is an NLU application.

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-36. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 6-46


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Review answers
1. The technique that is used to group together different inflected forms of a word into a base
word is called:
a. Stemming
b. Dependency Parsing (DP)
c. Chunking
d. Lemmatization

2. What is the process of labeling tokens with their grammatical label?


a. Word tokenization
b. POS tagging
c. Semantic analysis
d. Stemming

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-37. Review answers

© Copyright IBM Corp. 2018, 2022 6-47


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 6. Natural language processing concepts and components

Uempty

Review answers (cont.)


3. True or False: For any NLP task, you must apply every step in the NLP pipeline.
4. True or False: Sentiment analysis is an NLU application.

Natural language processing concepts and components © Copyright IBM Corporation 2019, 2022

Figure 6-38. Review answers (cont.)

© Copyright IBM Corp. 2018, 2022 6-48


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

Unit 7. Natural language processing


evaluation metrics
Estimated time
00:30

Overview
This unit explains how to evaluate the quality of your natural language processing (NLP) algorithm.

© Copyright IBM Corp. 2018, 2022 7-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

Unit objectives • Define various metrics to measure the quality of NLP algorithms.
• Explain the difference between these metrics.

© Copyright IBM Corporation 2018, 2022

Figure 7-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 7-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

System evaluation
• How can we measure the solution quality?
• Target: You developed a new search engine. You must define how well it works.

Natural language processing evaluation metrics © Copyright IBM Corporation 2018, 2022

Figure 7-2. System evaluation

How can we measure the solution quality? In this presentation, we focus on a basic metric to
evaluate system performance in information retrieval. Assume that you developed a search
algorithm that helps you to retrieve related words from a corpus that contains 1000 documents.
From these 1000 documents, assume 200 are relevant to the word cat, and the other 800
documents are irrelevant.

© Copyright IBM Corp. 2018, 2022 7-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

System evaluation (cont.)


• You ran a search test for the word “cat”.
• After the test ran, the search engine retrieved the documents that are shown here.

Natural language processing evaluation metrics © Copyright IBM Corporation 2018, 2022

Figure 7-3. System evaluation (cont.)

You test your solution by searching for the word “cat”. Your algorithm returns 250 documents,
where 150 documents are relevant (which means your algorithm missed 50 relevant documents)
and 100 documents are irrelevant (which means your algorithm correctly eliminated 700 of the
irrelevant documents).

© Copyright IBM Corp. 2018, 2022 7-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

System evaluation (cont.)


• Confusion matrix

ƒ How many relevant documents were retrieved by the algorithm?


150 documents Æ True positive (Tp).
ƒ How many irrelevant documents were retrieved by the algorithm?
100 documents Æ False positive (Fp)
(total 250 documents retrieved – 150 relevant documents).
ƒ How many relevant documents did the algorithm not retrieve?
50 documents Æ False negative (Fn).
ƒ How many irrelevant documents did the algorithm not retrieve?
700 documents Æ True negative (Tn).
•Natural language processing evaluation metrics © Copyright IBM Corporation 2018, 2022

Figure 7-4. System evaluation (cont.)

A confusion matrix, also known as an error matrix, is a specific table layout that enables
visualization of the performance of an algorithm.
Based on the results for this example, how many relevant documents were retrieved by the
algorithm? The answer is 150 documents. This value is the True positive (Tp).
Based on the results for this example, how many irrelevant documents were retrieved by the
algorithm? The answer is 100 documents (total 250 documents retrieved – 150 relevant
documents). This value is the False positive (Fp).
Based on the results for this example, how many relevant documents did the algorithm not
retrieve? The answer is 50 documents. This value is the False negative (Fn).
Based on the results for this example, how many irrelevant documents did the algorithm not
retrieve? The answer is 700 documents. This value is the True negative (Tn).
The objective is to improve the algorithm to decrease the Fp and Fn values.

© Copyright IBM Corp. 2018, 2022 7-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

System evaluation (cont.)

Natural language processing evaluation metrics © Copyright IBM Corporation 2018, 2022

Figure 7-5. System evaluation (cont.)

We map the confusion matrix to the graph to produce the visuals for Tp, Fp, Tn, and Fn. We add Tp
to the retrieved relevant documents area and Fp to the retrieved irrelevant area. We add Fn to the
not retrieved relevant area and Tn to the not retrieved irrelevant area.

© Copyright IBM Corp. 2018, 2022 7-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

System evaluation (cont.)


Accuracy
• Calculates how many correct results your solution managed to identify.

Accuracy = (Tp+Tn)/(Tp+Tn+Fp+Fn)

• Apply the formula to the example.

Accuracy = (150+700)/(1000)

• Useful for symmetric data sets where the values of positive and negatives are almost the
same.

Natural language processing evaluation metrics © Copyright IBM Corporation 2018, 2022

Figure 7-6. System evaluation (cont.)

Accuracy is as a numeric measure of how good your algorithm is. It calculates how many correct
results your solution managed to identify, which is the proportion of true results among the total
number of cases that are examined.
Accuracy is defined by the following formula, which includes the Tp, Tn, Fp, and Fn metrics:
Accuracy = (Tp+Tn)/(Tp+Tn+Fp+Fn)
By applying the values from the example, accuracy can be calculated as follows:
Accuracy = (150+700)/1000 = 0.85
Accuracy is a good measure but only when you have symmetric data sets where the number of
positive values and negatives values are almost the same. For example, if your data set is split as
90 positive samples and 10 negative samples, classifying all as positive gives a 0.90 accuracy
score.
Therefore, we must look at other metrics such as precision and recall to evaluate the quality of the
algorithm.

© Copyright IBM Corp. 2018, 2022 7-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

System evaluation (cont.)


Precision

• Represents the fraction of retrieved documents that are relevant.

Precision = Tp/(Tp+Fp)

• Apply the formula to the example.

Precision = 150/(150+100)
Precision = 150/250 = 0.60

Natural language processing evaluation metrics © Copyright IBM Corporation 2018, 2022

Figure 7-7. System evaluation (cont.)

Precision is a numeric measure that represents the fraction of retrieved documents that are
relevant. It is defined by the following formula:
Precision = Tp/(Tp+Fp)
Apply the formula to the example:
Precision = 150/(150+100)
150 retrieved relevant / 250 total retrieved = 0.60

© Copyright IBM Corp. 2018, 2022 7-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

System evaluation (cont.)


Recall

• Represents the fraction of relevant documents that were retrieved.

Recall = Tp/(Tp+Fn)

• Apply the formula to the following example.

Recall = (150)/(150+50)
Recall = 150/200 = 0.75

Natural language processing evaluation metrics © Copyright IBM Corporation 2018, 2022

Figure 7-8. System evaluation (cont.)

Recall is a numeric measure that represents the fraction of relevant documents that were
retrieved. It is defined by the following formula:
Recall = Tp/(Tp+Fn)
Apply the formula to the example:
Recall =150/(150+50)
150 retrieved relevant / 200 total relevant = 0.75

© Copyright IBM Corp. 2018, 2022 7-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

System evaluation (cont.)


F-Score (F-measure)

• Enables you to tradeoff precision against recall.

• The higher the F-score value is, the better the algorithm is.

• Here is the formula.

F = 2*Precision*Recall/(Precision+Recall)

• Apply the formula to the example.

F = (2*0.60*0.75)/(0.60+0.75)
F = 0.9/1.35= 0.6667

Natural language processing evaluation metrics © Copyright IBM Corporation 2018, 2022

Figure 7-9. System evaluation (cont.)

The F-score (also called F-measure) is a measure that enables you to tradeoff precision against
recall by approximately averaging the precision and recall values.
The formula for F-score is:
F = (2*Precision*Recall)/(Precision +Recall)
Apply the formula to the example:
F = (2*0.60*0.75)/(0.60+0.75)
= 0.9/1.35= 0.6667

© Copyright IBM Corp. 2018, 2022 7-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

Unit summary • Define various metrics to measure the quality of NLP algorithms.
• Understand the difference between these metrics.

© Copyright IBM Corporation 2018, 2022

Figure 7-10. Unit summary

© Copyright IBM Corp. 2018, 2022 7-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

Review questions
1. True or False: To calculate the F-score, you must calculate accuracy first.
2. True or False: Accuracy is the harmonic mean of precision and recall.
3. Assume that you developed an algorithm and calculated the Precision as 0.5 and the Recall as
0.5, what is the value of F-score in this case?
a. 0.25
b. 1.00
c. 0.50

Natural language processing evaluation metrics © Copyright IBM Corporation 2018, 2022

Figure 7-11. Review questions

1. False
2. False
3. C: 0.50

© Copyright IBM Corp. 2018, 2022 7-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

Review questions (cont.)


4. The F-score is calculated as (hint P=precision, R= Recall):
a. 2*(P+R)/(P+R)
b. 2*(P*R)/(P+R)
c. (P*R)/2*(P+R)
d. (P+R)/2*(P*R)

Natural language processing evaluation metrics © Copyright IBM Corporation 2018, 2022

Figure 7-12. Review questions (cont.)

4. B: 2*(P*R)/(P+R)

© Copyright IBM Corp. 2018, 2022 7-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

Review answers
1. True or False: To calculate the F-score, you must calculate accuracy first.
2. True or False: Accuracy is the harmonic mean of precision and recall.
3. Assume that you developed an algorithm and calculated the Precision as 0.5 and the Recall as
0.5. What is the value of F-score in this case?
a. 0.25
b. 1.00
c. 0.50

Natural language processing evaluation metrics © Copyright IBM Corporation 2018, 2022

Figure 7-13. Review answers

1. False
2. False
3. C: 0.50

© Copyright IBM Corp. 2018, 2022 7-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 7. Natural language processing evaluation metrics

Uempty

Review answers (cont.)


4. F-score is calculated as (hint P=precision, R= Recall):
a. 2*(P+R)/(P+R)
b. 2*(P*R)/(P+R)
c. (P*R)/2*(P+R)
d. (P+R)/2*(P*R)

Natural language processing evaluation metrics © Copyright IBM Corporation 2018, 2022

Figure 7-14. Review answers (cont.)

4. B: 2*(P*R)/(P+R)

© Copyright IBM Corp. 2018, 2022 7-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Unit 8. Natural language processing and


IBM Watson
Estimated time
00:30

Overview
This unit lists the Watson services and software that are based on natural language processing
(NLP) and explains the main capabilities of IBM Watson Natural Language Understanding and IBM
Watson Discovery.

© Copyright IBM Corp. 2018, 2022 8-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Unit objectives • List the NLP Watson services.


• List the Watson services that perform information extraction.
• Describe the capabilities of the IBM Watson Natural Language
Understanding.
• Describe the capabilities of IBM Watson Discovery.

© Copyright IBM Corporation 2019, 2020

Figure 8-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 8-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Topics • Watson NLP services


• Watson Natural Language Understanding
• Watson Discovery

© Copyright IBM Corporation 2019, 2020

Figure 8-2. Topics

© Copyright IBM Corp. 2018, 2022 8-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty
8.1. Watson NLP services

© Copyright IBM Corp. 2018, 2022 8-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Watson NLP
services

Figure 8-3. Watson NLP services

© Copyright IBM Corp. 2018, 2022 8-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Watson NLP services

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-4. Watson NLP services

Many Watson services have NLP at their core. The slide shows all the Watson NLP services on IBM
Cloud.
The remainder of this presentation focuses on two Watson NLP services:
• Natural Language Understanding
• Watson Discovery
Other presentations in this course cover Watson Assistant and Knowledge Studio in detail.

© Copyright IBM Corp. 2018, 2022 8-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Information extraction by using Watson services


• Watson NLP services that extract information from unstructured text:
ƒ Watson Natural Language Understanding
ƒ Watson Discovery

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-5. Information extraction by using Watson services

The Natural Language Understanding and Watson Discovery services are based on natural
language processing (NLP) technology to extract information from unstructured text. These
services can be used without training by the user because they include a built-in public model.
They are pre-trained on a public training data set and ready to use immediately. However, to
improve the accuracy of the service for a given domain, Natural Language Understanding and
Discovery should also be trained.

© Copyright IBM Corp. 2018, 2022 8-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty
8.2. Watson Natural Language Understanding

© Copyright IBM Corp. 2018, 2022 8-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Watson Natural
Language
Understanding

Figure 8-6. Watson Natural Language Understanding

© Copyright IBM Corp. 2018, 2022 8-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Watson Natural Language Understanding


• NLU extracts meaning from unstructured data.
• NLU processes input provided as text, HTML, or a public URL.
• NLU analyzes the input text and provides an output that includes a set of text analytics
features:

Extraction Classification or analysis Linguistics

• Entities • Sentiment • Semantic roles


• Keywords • Emotion • Syntax
• Concepts • Categories
• Relations • Tone (*)

• NLU can be extended with custom models for supported feature and language combinations.
ƒ Watson Knowledge Studio can be used to create a custom model for NLU to detect custom entities and
relations that are unique to your domain.
(*) Tone analysis is done by using a pre-built classifications model.
Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-7. Watson Natural Language Understanding

Watson Natural Language Understanding (NLU) includes a set of text analytics features that you
can use to extract meaning from unstructured data. NLU accepts user input and provides an
output that includes entities and relationships that are found in the text. NLU can also perform
sentiment analysis of the input text.
Input can be in the form of text, raw HTML, or a public URL. The service cleans HTML content
before analysis by default so the results can ignore most advertisements and other unwanted
content.
NLU can be extended with custom models for supported feature and language combinations.
You can create custom models by using Watson Knowledge Studio to detect custom entities and
relations in NLU that are unique to your domain.

Note

Tone analysis is done by using a pre-built classifications model. See next slide for more
information.

© Copyright IBM Corp. 2018, 2022 8-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty
Reference:
Natural Language Understanding
https://cloud.ibm.com/apidocs/natural-language-understanding#introduction
Watson Natural Language Understanding – Details
https://www.ibm.com/uk-en/cloud/watson-natural-language-understanding/details
Overview - Customizing models
https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understan
ding-customizing

© Copyright IBM Corp. 2018, 2022 8-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Watson Natural Language Understanding – Tone analytics


• With the Natural Language Understanding service, you can analyze and detect tone by using a
language-specific classifications model ID in your API request.
• Tone analysis is done by using a pre-built classifications model, which provides an easy way to
detect language tones in written text. It detects seven tones: sad, frustrated, satisfied,
excited, polite, impolite, and sympathetic.

Example Request Example Response

{ { (cont.)
"language": "en", "usage": { {
"text": "This is example text in English.", "text_units": 1, "confidence": 0.564849,
"features": { "text_characters": 60, "class_name": "excited"
"classifications": { "features": 1 },
"model": "tone-classifications-en-v1" }, {
} "language": "en", "confidence": 0.355816,
} "classifications": [ "class_name": "satisfied"
} .........

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-8. Watson Natural Language Understanding – Tone analytics

Tone analysis is done by using a pre-built classifications model, which provides an easy way to
detect language tones in written text. It detects seven
tones: sad, frustrated, satisfied, excited, polite, impolite, and sympathetic.
To detect tone, use the language-specific classifications model ID in your API request.
The language-specific tone model ID is formatted as tone-classifications-xx-v1, where xx is a
two-character language code.
Tone analytics is currently available for English and French languages only, as indicated in the
Language support topic at
https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understan
ding-language-support.
References:
Understanding tone analytics
https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understan
ding-tone_analytics#understanding-tone-analytics
Language support
https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understan
ding-language-support

© Copyright IBM Corp. 2018, 2022 8-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Natural Language Understanding demo

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-9. Natural Language Understanding demo

The IBM Watson Natural Language Understanding Text Analysis online demo at
https://www.ibm.com/demos/live/natural-language-understanding/self-service/home
demonstrates text analytics features that you can use to extract meaning from unstructured data
by using the NLU service. In the demo, you can choose from a domain sample to apply the
knowledge of unique entities and relations in a particular industry. Alternatively, you can analyze
your own text by using the base model. The following slides show this demo with a financial
domain sample.
Reference:
IBM Watson Natural Language Understanding Text Analysis
https://www.ibm.com/demos/live/natural-language-understanding/self-service/home

© Copyright IBM Corp. 2018, 2022 8-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Natural Language Understanding demo – Entities extraction

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-10. Natural Language Understanding demo – Entities extraction

Watson Natural Language Understanding includes out of the box capabilities to find people,
places, events, and other types of entities mentioned in your content.

© Copyright IBM Corp. 2018, 2022 8-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Natural Language Understanding demo – Keywords extraction

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-11. Natural Language Understanding demo – Keywords extraction

With Watson Natural Language Understanding, you can extract keywords and search for the
relevant ones.

© Copyright IBM Corp. 2018, 2022 8-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Natural Language Understanding demo – Concepts extraction

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-12. Natural Language Understanding demo – Concepts extraction

Natural Language Understanding can identify high-level concepts that are not necessarily directly
referenced in the text.

© Copyright IBM Corp. 2018, 2022 8-16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Natural Language Understanding demo – Relations extraction

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-13. Natural Language Understanding demo – Relations extraction

Natural Language Understanding can recognize when two entities are related and identify the type
of relation.

© Copyright IBM Corp. 2018, 2022 8-17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Natural Language Understanding demo – Sentiment analysis

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-14. Natural Language Understanding demo – Sentiment analysis

Natural Language Understanding can analyze the sentiment toward specific target phrases and
the sentiment of the document as a whole.

© Copyright IBM Corp. 2018, 2022 8-18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Natural Language Understanding demo – Emotion analysis

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-15. Natural Language Understanding demo – Emotion analysis

Natural Language Understanding can analyze emotion that is conveyed by specific target phrases
or by the document as a whole.

© Copyright IBM Corp. 2018, 2022 8-19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Natural Language Understanding demo – Categories classification

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-16. Natural Language Understanding demo – Categories classification

Natural Language Understanding can categorize your content by using a five-level classification
hierarchy.

© Copyright IBM Corp. 2018, 2022 8-20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Natural Language Understanding demo – Semantic roles

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-17. Natural Language Understanding demo – Semantic roles

Natural Language Understanding can parse sentences into subject-action-object form and
identify entities and keywords that are subjects or objects of an action.

© Copyright IBM Corp. 2018, 2022 8-21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Natural Language Understanding demo – Syntax

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-18. Natural Language Understanding demo – Syntax

Natural Language Understanding can identify tokens and sentences.

© Copyright IBM Corp. 2018, 2022 8-22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Natural Language Understanding demo – Custom entities

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-19. Natural Language Understanding demo – Custom entities

Natural Language Understanding allows you to include a custom model from Watson Knowledge
Studio so that you can extend the entities that are mentioned in your content to fit any domain.

© Copyright IBM Corp. 2018, 2022 8-23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Natural Language Understanding demo – Custom relations

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-20. Natural Language Understanding demo – Custom relations

Natural Language Understanding allows you to include a custom model from Watson Knowledge
Studio. This custom model includes the ability recognize when two entities are related and
identify the type of relation.

© Copyright IBM Corp. 2018, 2022 8-24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty
8.3. Watson Discovery

© Copyright IBM Corp. 2018, 2022 8-25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Watson Discovery

Figure 8-21. Watson Discovery

© Copyright IBM Corp. 2018, 2022 8-26


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Watson Discovery
• Adds cognitive search and content analytics to applications to identify patterns, trends, and
insights.
• Unlocks actionable insights in unstructured data.
• Unifies structured and unstructured data.
• Uses simple query language to eliminate the need for manual filtering of results.
• Parses documents and enables the user to search through the documents by using a natural
language query.
• Can be trained.
• Includes the Discovery API and Discovery tooling.
• Example application: Find answers to FAQs

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-22. Watson Discovery

Watson Discovery
With Watson Discovery, you can add a cognitive search and a content analytics engine to
applications to identify patterns, trends, and actionable insights that drive better
decision-making. You can rapidly build cognitive, cloud-based exploration applications that
unlock actionable insights that are hidden in unstructured data.
You can securely unify structured and unstructured data with pre-enriched content and use a
simplified query language to eliminate the need for manual filtering of results.
With Discovery, you can prepare your unstructured data, create a query to pinpoint the
information you need, and then integrate those insights into your new application or existing
solution.
The Watson Discovery services include:
• Discovery API. The Discovery service supports various SDKs to simplify the development of
applications. The SDKs are available for many popular programming languages and platforms,
including Curl, Java, NodeJS, Python, Go, .NET, Ruby, Swift, and Unity.
• Discovery tooling. The Discovery service includes a complete set of online tools, the Discovery
tooling, to help you quickly set up an instance of the service and populate it with data. The
Discovery service tooling was designed to save time by eliminating the need to use APIs to
configure and populate your service.
With Discovery, you can build applications that extract the correct answers to FAQs by enriching
and searching data collections.

© Copyright IBM Corp. 2018, 2022 8-27


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty
References:
Watson Discovery on Cloud Pak for Data as a Service
https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/watsondisc.html?context=cpda
as&audience=wdp
Discovery API documentation
https://cloud.ibm.com/apidocs/discovery-data?code=unity#introduction

© Copyright IBM Corp. 2018, 2022 8-28


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Watson Discovery flow


• Discovery provides an end-to-end solution that includes:
ƒ Connect your data to Discovery.
ƒ Teach Discovery to understand the language and concepts
that are unique to your business and industry.
ƒ Enrich your data with NLU technologies to identify key
information and patterns.
ƒ Build search solutions that find answers to queries.
ƒ Explore your data to uncover patterns and insights.
ƒ Leverage search results in automated workflows.

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-23. Watson Discovery flow

IBM Watson Discovery is an AI-powered search engine that helps you to extract answers from
complex business documents.
Use Discovery to visually train AI for deep understanding of your content, including tables and
images to help you find business value that is hidden in your enterprise data. Use natural language
or structured queries to find relevant answers, surface insights, and build AI-enhanced business
processes anywhere.
Start by connecting your data to Discovery. Next, teach Discovery to understand the language and
concepts that are unique to your business and industry. Enrich your data with award-winning
Natural Language Understanding (NLU) technologies so you can identify key information and
patterns. Finally, build search solutions that find answers to queries, explore your data to uncover
patterns and insights, and leverage search results in automated workflows.
Supported file types: CSV, DOC, DOCX, GIF, HTML, JPG, JSON, PDF, PNG, PPT, PPTX, TIFF, TXT,
XLS, XLSX
References:
About Watson Discovery
https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-about
Supported file types
https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-collections#supportedfiletyp
es

© Copyright IBM Corp. 2018, 2022 8-29


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Unit summary • List the NLP Watson services.


• List the Watson services that perform information extraction.
• Describe the capabilities of the IBM Watson Natural Language
Understanding.
• Describe the capabilities of IBM Watson Discovery.

© Copyright IBM Corporation 2019, 2020

Figure 8-24. Unit summary

© Copyright IBM Corp. 2018, 2022 8-30


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Review questions
1. True or False: Watson Natural Language Understanding parses documents and enables the
user to search through the documents by using a natural language query.
2. True or False: You can teach Discovery to understand the language and concepts that are
unique to your business and industry.
3. Watson Discovery provides one of the following capabilities:
a. Returns best matching image.
b. Identifies a variety of tones at both the sentence and document level.
c. Adds cognitive search and content analytics to applications to identify patterns, trends, and insights.

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-25. Review questions

© Copyright IBM Corp. 2018, 2022 8-31


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Review questions (cont.)


4. True or False: The NLU Semantic Role feature parses sentences into subject-action-object
form and identifies entities and keywords that are subjects or objects of an action.
5. Knowledge Studio can be used to extend NLU with custom models to detect ________ in your
domain.
a. Sentiment and emotions
b. Entities and relations
c. Syntax and sentences
d. None of the above

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-26. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 8-32


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Review answers
1. True or False: Watson Natural Language Understanding parses documents and enables the
user to search through the documents by using a natural language query.
2. True or False: You can teach Discovery to understand the language and concepts that are
unique to your business and industry .
3. Watson Discovery provides one of the following capabilities:
a. Returns best matching image.
b. Identifies a variety of tones at both the sentence and document level.
c. Adds cognitive search and content analytics to applications to identify patterns, trends, and insights.

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-27. Review answers

© Copyright IBM Corp. 2018, 2022 8-33


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Review answers (cont.)


4. True or False: The NLU Semantic Role feature parses sentences into subject-action-object
form and identifies entities and keywords that are subjects or objects of an action.
5. Knowledge Studio can be used to extend NLU with custom models to detect ________ in your
domain.
a. Sentiment and emotions
b. Entities and relations
c. Syntax and sentences
d. None of the above

Natural language processing and IBM Watson © Copyright IBM Corporation 2019, 2020

Figure 8-28. Review answers (cont.)

© Copyright IBM Corp. 2018, 2022 8-34


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty
Exercise: Ingesting, converting, enriching, and querying
data with the IBM Watson Discovery service

Figure 8-29. Exercise: Ingesting, converting, enriching, and querying data with the IBM Watson Discovery service

© Copyright IBM Corp. 2018, 2022 8-35


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 8. Natural language processing and IBM Watson

Uempty

Exercise • With Watson Discovery, it takes only a few steps to prepare your
unstructured data, create a query that pinpoints the information that
objectives you need, and then integrates those insights into your new
application or existing solution.This exercise takes you through the
process of preparing and querying a collection of documents.

• After completing this exercise, you should be able to:


ƒ Create a Watson Discovery service instance.
ƒ Create a collection.
ƒ Add content to a collection.
ƒ Create a custom configuration.
ƒ Build queries.
ƒ Use the Watson Discovery API.

© Copyright IBM Corporation 2019, 2020

Figure 8-30. Exercise objectives

© Copyright IBM Corp. 2018, 2022 8-36


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Unit 9. Introduction to IBM Watson


Knowledge Studio
Estimated time
00:45

Overview
This unit introduces IBM Watson Knowledge Studio, its capabilities, and features. This unit
explains the end-to-end domain adaptation process.

© Copyright IBM Corp. 2018, 2022 9-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Unit objectives • Describe IBM Watson Knowledge Studio.


• List the Watson services that are trained by Knowledge Studio.
• List the Knowledge Studio workspace resources.
• Explain the process to build Knowledge Studio models that can be
deployed and used with other Watson services.

© Copyright IBM Corporation 2018, 2022

Figure 9-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 9-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Topics • IBM Watson Knowledge Studio overview


• Watson Knowledge Studio features
• Adapting the system to a new domain

© Copyright IBM Corporation 2018, 2022

Figure 9-2. Topics

© Copyright IBM Corp. 2018, 2022 9-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty
9.1. IBM Watson Knowledge Studio overview

© Copyright IBM Corp. 2018, 2022 9-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

IBM Watson
Knowledge Studio
overview

Figure 9-3. IBM Watson Knowledge Studio overview

© Copyright IBM Corp. 2018, 2022 9-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Watson Knowledge Studio

Teach by Example Extract Value at Scale

• Empower subject matter • Process documents with your


experts without technical custom language model to
skills to teach Watson the find entities and meaningful
language of your industry relationships between them.
Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-4. Watson Knowledge Studio

Teach by Example
Empower subject matter experts without technical skills to teach Watson the language of your
industry.
Extract Value at Scale
Process documents with your custom language model to find entities and meaningful
relationships between them.
Reference:
Watson Knowledge Studio
https://www.ibm.com/demos/live/watson-knowledge-studio/self-service

© Copyright IBM Corp. 2018, 2022 9-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Watson Knowledge Studio (cont.)


• Use Knowledge Studio to create:

A machine learning model A rule-based model

• Understands the linguistic nuances, • Finds entities in documents


meaning, and relationships that are
specific to your industry.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-5. Watson Knowledge Studio (cont.)

Knowledge Studio is a service on IBM Cloud that can help you create a machine learning model
that understands the linguistic nuances, meaning, and relationships that are specific to your
domain. It also can help you create a rule-based model that finds entities in documents based on
rules that you define.
• Machine learning model. Uses a statistical approach to find entities and relationships in
documents. This type of model can adapt as the amount of data grows.
• Rule-based model. Uses a declarative approach to finding entities in documents. This type of
model is more predictable and easier to comprehend and maintain. However, it does not learn
from new data. It can find only patterns that it was trained to find.
References:
Watson Knowledge Studio
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-wks_ov
erview_full
Why you should use Watson Knowledge Studio
https://www.youtube.com/watch?v=r2xYHW0iyZM&index=3&list=PLZDyxLlNKRY9yM_Deg6GhT
U1WS0-JLwyX&
Annotating documents
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-user-g
uide

© Copyright IBM Corp. 2018, 2022 9-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Build a machine learning model


• Knowledge Studio provides easy-to-use tools for annotating unstructured domain literature.
• Uses those annotations to create a custom machine learning model.
• The accuracy of the model improves through iterative testing.
• Deploy the finished model to find and extract mentions of relationships and entities.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-6. Build a machine learning model

Knowledge Studio provides easy -to-use tools for annotating unstructured domain literature and
uses those annotations to create a custom machine learning model that understands the
language of the domain. The accuracy of the model improves through iterative testing, ultimately
resulting in an algorithm that can learn from the patterns that it sees and recognizes those
patterns in large collections of new documents.
You can deploy the finished machine learning model to other Watson cloud-based offerings and
cognitive solutions to find and extract mentions of relationships and entities, including entity
coreferences.
Reference:
Watson Knowledge Studio
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-wks_ov
erview_full

© Copyright IBM Corp. 2018, 2022 9-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Building a machine learning model (cont.)


1. Import domain-specific documents.
2. Human annotators annotate documents.
3. Knowledge Studio uses a ground truth to train a model.
4. A trained model is ready to find entities, relationships, and co-references in new documents.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-7. Building a machine learning model (cont.)

1. Based on a set of domain-specific source documents, the team creates a type system that
defines entity types and relation types for the information of interest to the application that
uses the model.
2. A group of two or more human annotators annotates a small set of source documents to label
words that represent entity types, identify relationship types where the text identifies
relationships between entity mentions, and define co-references, which identify different
mentions that refer to the same thing, that is, the same entity. Any inconsistencies in the
annotations are resolved, and one set of optimally annotated documents is built, which forms
the ground truth.
3. Knowledge Studio uses the ground truth to train a model.
4. The trained model is used to find entities, relationships, and co-references in new documents.
Reference:
Watson Knowledge Studio
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-wks_ov
erview_full

© Copyright IBM Corp. 2018, 2022 9-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Building a rule-based model


• Knowledge Studio provides a rules editor that simplifies the process of finding and capturing
common patterns in your documents as rules.
• Create rules to capture patterns in documents and convey information about underlying entity
types.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-8. Building a rule-based model

Create a rule-based model that can recognize patterns in your documents. Use rules to capture
patterns that occur in documents and convey information about underlying entity types. Rules can
be defined to recognize person’s names, money, dates, percentage, and more.
Reference:
Watson Knowledge Studio
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-wks_ov
erview_full

© Copyright IBM Corp. 2018, 2022 9-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Building a rule-based model (cont.)


• Tools to define rules:
ƒ Dictionary
ƒ Regular expression tool (Regex tool)
• Use the rule-based model to do useful things like pre-annotating documents to speed up the
human annotation process for a machine learning model.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-9. Building a rule-based model (cont.)

Knowledge Studio provides a rule editor that simplifies the process of finding and capturing
common patterns in your documents as rules. It uses dictionaries to speed up the annotation
process.
The rule editor provides some tools that help you define rules:
• Dictionary. Add a dictionary and assign it a class name. Any words that are found that match
entries in the dictionary are automatically annotated with the dictionary class.
• Regular expression. A regular expression is a sequence of characters that define a search
pattern. The Regex tool that is included in the rule editor recognizes expressions. For example,
your documents might have several references like the following ones:
▪ 35-year-old driver
▪ 16-year-old learner
The syntax n-year-old x is a pattern that typically represents a person. You can define a regular
expression rule to find phrases that match the n-year-old x pattern, and annotate them as
PERSON entity mentions.
References:
Rules
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-rule-an
notator
Using the rule-based model
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-wks_ru
le_publish

© Copyright IBM Corp. 2018, 2022 9-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Machine learning based model versus a rule-based model

Model type Pros Cons

Machine • Statistical (teaches by example). • Requires work to develop a supervised


learning • Useful for complex text extraction that has corpora (ground truth), and it requires
based many variations. certain amount of data.
• Scalable. • Sometime trapped by corner cases.

Rule based • Declarative (codify a set of rules). • Requires work to develop, write, and
• Useful for basic text extraction, for define a set of rules.
example, extracting emails, URLs, and • As complexity grows, maintenance
phone numbers. becomes an issue.
• Easy to comprehend and maintain.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-10. Machine learning based model versus a rule-based model

Machine learning models learn by examples that contain the information that we want to extract
for the specific domain. A machine learning model is useful when the information that you are
interested in does not have a certain form that can be codified into a rule, which is the case with
unstructured natural language.
Rule-based models are most useful when they are used to extract data that is known to have a
certain format, such as email addresses or phone numbers. If the information can come in many
forms, then you must define a rule or set of rules for each format. This approach is inefficient if the
information that you must extract comes in many forms and has many variations.
The table summarizes both model types and their pros and cons.

© Copyright IBM Corp. 2018, 2022 9-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Why do we need Watson Knowledge Studio


• With Knowledge Studio, you can create, evaluate, and improve models for new domains.
• A model adds annotations (metadata) to text that appears in natural language content.
• The annotations, identify mentions of entities of interest in your domain content, the
relationships between them, and how the mentions co-reference the same entity.
• Applications can use the annotations to automatically analyze and process text.
• Application users benefit from this level of analysis by extracting meaning, discovering
insights, and obtaining answers in a natural language context.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-11. Why do we need Watson Knowledge Studio

With Knowledge Studio, you can create, evaluate, and improve models for new domains. A model
adds annotations (metadata) to text that appears in natural language content. The annotations,
which identify mentions of entities of interest in your domain content, the relationships between
them, and how the mentions co-reference the same entity, can be used by applications to
automatically analyze and process text. Application users benefit from this level of analysis by
being able to extract meaning, discover insights, and obtain answers in a natural language
context.

© Copyright IBM Corp. 2018, 2022 9-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Why do we need Watson Knowledge Studio (cont.)


• Teach by example: Empower domain subject
matter experts to teach Watson the language of
your domain without requiring deep technical
skills or coding.
• Engage your experts: Bring your experts
together in a collaborative online environment to
teach Watson.
• Use everywhere: Apply your models to Watson
Discovery and Watson Natural Language
Understanding.
• Knowledge Studio is end-to-end: Combines
annotation, training, and evaluation in a single
collaboration-focused service.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2019, 2022

Figure 9-12. Why do we need Watson Knowledge Studio (cont.)

To become a subject matter expert in an industry or domain, Watson services must be trained to
understand specialized terminology and the relationships between entities. Knowledge Studio
facilitates the training of some Watson offerings. Knowledge Studio simplifies the task of building
machine learning models by helping subject matter experts to train Watson based on examples
without code.
By using Knowledge Studio, you can:
• Teach by example: Empower domain subject matter experts to teach Watson the language of
your domain without requiring deep technical skills or coding.
• Engage your experts: Bring your experts together in a collaborative online environment to
teach Watson how to understand the linguistic nuances of your domain.
• Use everywhere: Apply what you taught Watson in multiple applications by using models
from Knowledge Studio in Discovery and Natural Language Understanding.
• Knowledge Studio is end-to-end: It is the only offering in the market that combines the
powerful capabilities of annotation, training, and evaluation in a single collaboration-focused
service.

© Copyright IBM Corp. 2018, 2022 9-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Watson Knowledge Studio demo

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-13. Watson Knowledge Studio demo

The slide shows an example that demonstrates a custom financial model that is trained with
Watson Knowledge Studio that tracks key financial metrics values, changes, and drivers in an
automatic report.
Reference:
Custom financial model
https://www.ibm.com/demos/live/watson-knowledge-studio/self-service/home

© Copyright IBM Corp. 2018, 2022 9-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Watson Knowledge Studio integration


• The model that you create with Knowledge Studio is a software component that can be
plugged into a natural language processing (NLP) pipeline.
• You can deploy a machine learning or rule-based model to use with the Natural Language
Understanding and the Watson Discovery services.
• You can use the Natural Language Understanding service to pre-annotate documents that you
add to your corpus.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-14. Watson Knowledge Studio integration

The model that you create with Knowledge Studio is a software component that can be plugged
into a natural language processing (NLP) pipeline.
You can deploy the finished machine learning model to other Watson cloud-based offerings and
cognitive solutions to find and extract mentions of relations and entities, including entity
coreferences.
• Deploy a machine learning or rule-based model to use with the Watson Discovery service.
• Deploy a machine learning or rule-based model to use with the Natural Language
Understanding service.
• Bootstrap annotation by using the Natural Language Understanding service to automatically
find and annotate entities in your documents. When human annotators begin to annotate the
documents, they can see the annotations that were already made by the service and can
review and add to them. See Pre-annotating documents with Natural Language
Understanding at
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-pre
annotation#wks_preannotnlu for details.
References:
Watson services integration
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-wks_ov
erview_full#wks_watsoninteg
Pre-annotating documents with Natural Language Understanding
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-preann
otation#wks_preannotnlu

© Copyright IBM Corp. 2018, 2022 9-16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty
9.2. Watson Knowledge Studio features

© Copyright IBM Corp. 2018, 2022 9-17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Watson Knowledge
Studio features

Figure 9-15. Watson Knowledge Studio features

© Copyright IBM Corp. 2018, 2022 9-18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Creating a workspace
• Create a single workspace for each model.
• The workspace contains the artifacts and resources
that are needed to build the model.
• One workspace can contain one rule-based model
and one machine learning model.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-16. Creating a workspace

The first step in building a custom model is to create a workspace. For each model that you want
to build and use, create a single workspace that contains the artifacts and resources that are
needed to build the model. You can create one workspace that contains both one rule-based
model and one machine learning model. Then, you train the model to produce a custom model
that can be deployed to an external service for use. Follow these steps:
1. Give your workspace a name and provide a description about the domain to easily remember
it.
2. Choose the language of your trained documents and dictionaries.
3. Optional: If you want to change the tokenizer that is used by the application from the default
machine learning-based tokenizer, expand the Advanced Options section and select
Dictionary-based tokenizer. For more information, see the References for this slide.
4. Optional: You can add project manager role, but because you have a Lite plan subscription,
skip this step. You cannot add other users. As an administrator, you can perform all the tasks
that a project manager typically performs.
References:
Creating a workspace
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-create-
project
Watson Knowledge Studio Technical Deep Dive Demo
https://www.youtube.com/watch?v=EQcEk2TX79c

© Copyright IBM Corp. 2018, 2022 9-19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Workspace resources
• You add the following types of resources to the workspace:
ƒ Type system
ƒ Dictionaries
ƒ Documents
• The resources are either created or uploaded for training the models.
• Each of these resources can be used differently depending on the model type.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-17. Workspace resources

The Knowledge Studio workspace contains the following types of resources:


• Type System. Defines the entities and relationships between entities that matter to you.
• Dictionaries. Group words and phrases that should be treated equivalently by a model.
• Documents. Serve a different purpose depending on whether you are creating a machine
learning model or a rule-based model.
The resources are either created or uploaded to train the models.
Each of these resources might be used differently depending on the model type.
Reference:
Types of artifacts
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-artifact
s

© Copyright IBM Corp. 2018, 2022 9-20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Type system
• Defines entities and relationships between entities that are interesting for your domain:
ƒ Mentions. Example: “Watson”, “IBM”.
ƒ Entity types. Example: “PERSON”, “ORGANIZATION”.
ƒ Relation types. Example: founderOf, employedBy.
• Controls how content can be annotated.
• Can be created from scratch or uploaded from an existing type system.
• If you create a type system from scratch, define it directly in the Knowledge Studio editor.
• To avoid visual overload for human annotation, define no more than 50 entity types and 50
relation types.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-18. Type system

A type system defines things that are of interest in your domain content that you want to label
with an annotation:
• Mentions. A mention is any span of text that you consider relevant in your domain data. For
example, “President Obama” or “IBM”.
• Entity types. Categorize a real-world thing. An entity mention is an example of a thing of that
type. For example, the mention President Obama can be annotated as a PERSON entity type.
The mention IBM can be annotated as an ORGANIZATION entity type.
• Relation types. Define a binary and ordered relationship between two entities. For a relation
mention to exist, the text must explicitly define the relation and bind mentions of the two
entities together and must do so within a single sentence. For example, the sentence “Mary
works for IBM” is textual evidence of the employedBy relation type.
The type system controls how content can be annotated by defining the types of entities that can
be labeled and how relationships among different entities can be labeled. The model process
manager typically works with subject matter experts for your domain to define the type system.
In Knowledge Studio, you can create a type system from scratch or upload one from an existing
type system. To start a workspace, you might want to upload a type system that was created for a
similar domain. You can then edit the type system to add or remove entity types or redefine the
relationship types.
Reference:
Establishing a type system
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-typesy
stem

© Copyright IBM Corp. 2018, 2022 9-21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Dictionary
• A dictionary groups words and phrases that should be treated equivalently by a model.
Example:
ƒ September, Sept, Sep.
ƒ Monday, Tuesday, Wednesday (DAY_OF_WEEK).

• Dictionaries help the Knowledge Studio machine learning models to understand the language
of the domain.

• You can create dictionaries in Knowledge Studio:


ƒ Manually by adding individual entries.
ƒ Upload several types of dictionary files.

• Several general-purpose dictionaries are built into the application.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-19. Dictionary

Dictionaries
In machine learning, a dictionary groups words and phrases that share something . An entry in the
dictionary does not mean that all words in the entry mean the same thing, but that the words are
to be treated equivalently by a model. A dictionary is a list of words or phrases that are equivalent
for information-extraction purposes, meaning that they are interchangeable for the purposes of
identifying entity and relation mentions.
Consider this example: A dictionary entry contains the seven days of the week. To annotate a
document, a human annotator assigns the entity type DAY_OF_WEEK to mentions of Monday and
Friday in the text. Because the dictionary equates the seven days of the week, it helps ensure that
a machine learning model correctly annotates occurrences of Tuesday, Wednesday, and the other
days of the week in unseen documents at run time. In addition, equating these words also
benefits information extraction in the surrounding text. What the machine learning model learns
from training examples about the texts near Monday and Friday is applied to texts that the
machine learning model sees near other days of the week because the dictionary states that these
terms are equivalent for information-extraction purposes.
You do not need to create a dictionary that contains days of the week information. Several
general-purpose dictionaries are built in to the application. Other built-in dictionaries include
countries, place names, number words, animals, plants, diseases, measurement words (such as
ounce and meter), and salutation title words (such as Mr. and Mrs.). You cannot disable or edit
built-in dictionaries.
Reference:
Creating dictionaries
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-diction
aries

© Copyright IBM Corp. 2018, 2022 9-22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Dictionary usage
• Adding dictionaries is optional and can be used in two ways:
ƒ Machine learning usage. Used by the machine learning model to provide words or phrases that are
equivalent for information-extraction purposes.
ƒ Pre-annotation usage. Used during pre-annotation to bootstrap the annotation effort.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-20. Dictionary usage

Adding dictionaries is optional and can be used in two ways:


• Machine learning usage. The machine learning model does not assume that a mention has a
specific entity type just because the mention matches an entry in a dictionary that is
associated with that entity type. It accounts for that information but treats it as one piece of
information among other pieces of information that it gathers through linguistic analysis. In
fact, if none of the terms in a dictionary occur in the ground truth documents, then the
dictionary is not used at all by the machine learning model.
• Pre-annotation usage. Dictionaries are important to the following pre-annotation processes:
▪ Dictionary pre-annotator. You associate a dictionary with an entity type from the type
system when you run the dictionary pre-annotator.
▪ Rule-based model. You can optionally associate a dictionary with a rule class. Classes are
then mapped to entity types from the type system when you run the rule-based model to
pre-annotate documents. As a result, dictionary terms are, although circuitously, mapped
to entity types for the rule-based model also.
In both cases, the dictionaries provide terms that the system can find and annotate as mentions.
It assigns to each mention the entity type that is associated with the dictionary that contains the
term. When a human annotator begins work on new documents that were pre-annotated, many
mentions are already annotated based on the dictionary entries. The human annotator thus has
more time to focus on assigning entity types to mentions that require deeper analysis.
Reference:
Creating dictionaries
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-diction
aries

© Copyright IBM Corp. 2018, 2022 9-23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Documents
• Usage for a machine learning model:
ƒ Documents are used to train the machine learning model when they are annotated.
ƒ Examples: Journal articles or other industry-specific texts that are related to the domain for which the
model is built.
• Usage for a rule-based model:
ƒ Add or upload documents from which you can draw patterns to define as rules.
ƒ Add documents with linguistic patterns that illustrate the types of rules you want to define.
• Documents that you add for defining rules are kept separate from documents that you add for
annotation.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-21. Documents

Documents are the main resources that are needed for custom model creation. Documents are
used for different purposes based on the model that is created.
• For a machine learning model:
▪ Documents are used to train the machine learning model when they are annotated.
▪ Examples: Journal articles or other industry-specific texts that are related to the domain
for which the model is built.
• For a rule-based model:
▪ Add or upload documents from which you can draw patterns to define as rules.
▪ Add documents with linguistic patterns that illustrate the types of rules you want to define.
Documents that you add for defining rules are kept separate from documents that you add for
annotation.
Reference:
Annotating documents
https://cloud.ibm.com/docs/watson-knowledge-studio?topic=watson-knowledge-studio-user-g
uide

© Copyright IBM Corp. 2018, 2022 9-24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty
9.3. Adapting the system to a new domain

© Copyright IBM Corp. 2018, 2022 9-25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Adapting the
system to a new
domain

Figure 9-22. Adapting the system to a new domain

© Copyright IBM Corp. 2018, 2022 9-26


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Model life cycle: End-to-end domain adaptation


• Adapting a system to a new domain, requires an iterative process with continuous
improvements to increase the performance of the system.
• The creation of a model is an iterative multiple-step process that involves these stages:
1. Knowledge curation
2. Ground truth generation
3. Model development
4. Model evaluation
5. Model deployment

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-23. Model life cycle: End-to-end domain adaptation

Adapting a cognitive system to a new domain, requires an iterative process with continuous
improvements to increase the performance of the system. This iterative process aims to reach a
level of incremental accuracy performing activities such as adding new functions, testing the
system, identifying opportunities to improve the performance, doing headroom analysis, and
finding possible solutions for the most frequent errors. The process requires the collaboration of
domain experts, data scientists, natural language processing (NLP) experts, and machine learning
developers.
The creation of a model is an iterative multiple-step process that involves several stages:
knowledge curation, ground truth generation, model development, model evaluation, and model
deployment.
The diagram summarizes the interactions between these five stages of model development and
the typical activities that occur at each stage.
Reference:
Building Cognitive Applications with IBM Watson Services: Volume 1 Getting Started
http://www.redbooks.ibm.com/redbooks.nsf/redbookabstracts/sg248387.html?Open

© Copyright IBM Corp. 2018, 2022 9-27


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Knowledge curation
• This stage refers to the process of selecting, collecting, preserving, and maintaining content
relevant to a specific domain.
• This stage is external to Knowledge Studio.
• Curation adds value to data: It transforms data into trusted information and knowledge.
• Knowledge curation involves the following activities:
ƒ Ensuring that the selected documents are representative of the domain content.
ƒ Ensuring that selected documents cover the entity types and relation types that are defined in your
type system.
ƒ Providing more documents for a complex type system, and fewer for a simpler one.
ƒ Limiting each document to a page or two of content. This is a preferred practice, especially in the early
stages of model development.
ƒ Ensuring that the documents include variations in vocabulary and phrasing.
ƒ In the case of skewed frequency-of-occurrence of entity types and relation types, trying to get at least
50 exemplars of each type.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-24. Knowledge curation

Curation adds value to data by transforming data into trusted information and knowledge. This
stage, which is external to Knowledge Studio, refers to the process of selecting, collecting,
preserving, and maintaining content relevant to a specific domain. This stage is important
because the curated content is used as input in the following stage.
You must ensure that the collected content is representative of your domain content and of high
value to your application.
Ensure that the collected content covers the entity types and relation types that are defined in
your type system. Sometimes, even a representative small sample of documents in the domain of
interest is collected and the type system is modified and refined based on it.
Ensure that the data in the documents is distributed across all possible entity types, subtypes,
and roles, and the relationships between them. A goal to aim for is to have at least 50 annotations
for each entity type and 50 for each relation type in the document collection.
Strive to provide a set of documents that have a total size of about 300,000 words. Provide more
words for a complex type system, and fewer for a simpler one.
Limit each document to a page or two of content (fewer than 2,000 words, and closer to 1,000
words per document is best). In the early stages of model development, keeping each document
down to a few paragraphs is a preferred practice. A human annotator can mark mentions and
relations in a long document but attempts to mark co-references across multiple pages might
prove unwieldy.
Documents should represent the breadth of the subject matter that the application covers. In the
case of skewed frequency-of-occurrence of entity types and relation types, try to get at least 50
exemplars of each type, and more for entity types that have mentions that tend to be phrases..

© Copyright IBM Corp. 2018, 2022 9-28


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty
Reference:
Adding documents for annotation
https://github.com/IBM-Bluemix-Docs/watson-knowledge-studio/blob/master/documents-for-a
nnotation.md

© Copyright IBM Corp. 2018, 2022 9-29


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Ground truth generation


• This stage refers to the use of Knowledge Studio tools and best practices to produce a
collection of vetted data that is called ground truth or gold standard documents.
ƒ The ground truth is used to adapt a Watson solution to a particular domain.
• Ground truth generation involves the following activities:
1. SMEs creating or identifying the following resources for your domain:
> Annotation guidelines and example for human annotators.
> Type systems that define domain-specific objects and features.
> Dictionaries of terms that are to be treated as equivalent terms in your domain content.

2. Creating a corpus of documents that are representative of your domain content.


3. Pre-annotating documents based on the dictionaries that you add to a Knowledge Studio workspace.
4. Annotating documents by human annotators. Documents are divided among human annotators who
then use the Knowledge Studio ground truth editor to manually add annotations.
5. Comparing the human annotation results and resolving conflicts.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-25. Ground truth generation

This stage refers to the use of Knowledge Studio tools and best practices to produce a collection
of vetted data that can be used to adapt a Watson solution to a particular domain. The accuracy of
this vetted data, which is called ground truth or gold standard documents, is critical because
inaccuracies in the ground truth correlate to inaccuracies in the applications that rely on it.
An essential part of teaching Watson about a new domain involves providing it with knowledge
about entities of interest in your domain content, the relationships between them, and how the
entities co-reference each other. Collecting this knowledge includes the following activities:
1. Involving domain subject matter experts to create the following resources, or to identify
existing resources that can be reused or modified for your domain:
▪ Annotation guidelines and examples to help human annotators learn how words and
passages in your domain content are to be annotated.
▪ Type systems that define the domain-specific types (objects) and features (data
classifications) that can be discovered in your domain content through text analysis. The
type system controls the types of annotations that a human annotator can add to
documents.
▪ Dictionaries of terms that are to be treated as equivalent terms in your domain content.
2. Creating a corpus of documents that are representative of your domain content.

© Copyright IBM Corp. 2018, 2022 9-30


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty
3. Pre-annotating documents based on the dictionaries that you add to a Knowledge Studio
workspace.
This is an optional activity to make the process of human annotation easier. Instead of starting
from scratch, it creates a base on which the human annotators can build.
After you create a machine learning model, you can use the model to pre-annotate new
documents that you add to the corpus. Pre-annotation is a process of machine-annotating a
document to the extent possible before a machine learning model is available to do so.
Pre-annotation can reduce human-annotation labor by replacing some human annotation
creation with mere verification of the correctness of machine annotation.
4. Annotating documents by human annotators. Documents are divided among human
annotators, who then use the IBM Watson Knowledge Studio ground truth editor tool to
manually add annotations to small sets of documents. Humans annotate mentions, relations,
and co-references. The annotated documents are used as training and testing data for the
machine learning model.
5. Comparing the human annotation results and resolving conflicts. Adjudication in this phase is
needed to ensure accurate and consistently annotated documents are promoted to ground
truth, where they can be used to train and test a machine learning model.
Reference:
Adding documents for annotation
https://github.com/IBM-Bluemix-Docs/watson-knowledge-studio/blob/master/documents-for-a
nnotation.md

© Copyright IBM Corp. 2018, 2022 9-31


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Model development
• This stage refers to the use of Knowledge Studio tools to create the model.
• After the ground truth is generated, the human annotation results are used to train an
algorithm for automatically adding annotations to large collections of documents, such as
collections that include millions of documents.
• Model development involves the following activities:
1. Selecting the document sets that you want to use to train the model.
> Note: Only documents that became ground truth through approval or adjudication can be used to train the machine
learning model.

2. Specifying the percentage of documents that are to be used as training data, test data, and blind
data.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-26. Model development

This stage refers to the use of Knowledge Studio tools to create a model. After establishing ground
truth, the human annotation results can be used to train an algorithm for automatically adding
annotations to large collections of documents, such as collections that include millions of
documents.
Model development involves the following activities:
1. Selecting the document sets that you want to use to train the model.
Note: Only documents that became ground truth through approval or adjudication can be
used to train the machine learning model.
2. Specifying the percentage of documents that are to be used as training data, test data, and
blind data.
The documents that you add to the system must be allocated to the following system-level data
sets when you create a machine learning model:
• Training set: A set of documents that was annotated through pre-annotation or by human
annotators that is used to train the model. The goal of the training set is to teach the machine
learning model about correct annotations, which includes teaching the model through text
that was not annotated.
• Test set: A set of annotated documents that is used to test the trained model. After you run a
test on the test set, perform a detailed diagnostic-purposed error analysis of the results. Close
analysis helps you find weaknesses in the current model that can be addressed.

© Copyright IBM Corp. 2018, 2022 9-32


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty
• Blind set: A set of annotated documents that is set aside and used to test the system
periodically after several iterations of testing and improvement have occurred. To prevent
accuracy from being tainted (for example, by making changes base only on annotations in
known documents), blind data should be data that has not previously been viewed by users
that were involved with creating the model. Reported results should come only from tests that
are run on blind data. After you run a test on the blind set, look at only the most high-level
scores, such as the overall mention and relation F1 scores. You do not want to learn too many
details about the performance, or it might influence the improvements that you choose to
make to the model.
The goal of Knowledge Studio is to enable large teams to work together to build models. As such,
it assumes that models are being produced by a team that includes a group of human annotators
and a separate person or group of people that builds and tests the model, and makes
improvements to it. Due to this assumption, the application is configured to push an equally
proportioned grouping of documents from a single document set into the test, train, and blind
sets. However, if your team is not segregated (for example, the people doing human annotation
are also reviewing model test results in detail), then you might need to change the allocation of
documents in these sets to more explicitly separate the documents that are being used in each
one.
Why do I need a blind set?
Because you use test data to assess accuracy in detail, you get to know the documents and their
features after a while. For example, you start to know which entity types, relation types, and text
types in the documents are best understood by the machine learning model, and which are not.
This information is important because it helps you focus on making the right improvements, that
is, refining the type system, supplementing the training data to fill gaps, or adding dictionaries. As
the test documents are used iteratively to improve the model, they can start to influence the
model training indirectly. For this reason, the "blind" set of documents is very important.
You can review the annotations that are made on the test set. Infer which are undertrained
entities and cycle through the steps again to provide better training material for these entities.

© Copyright IBM Corp. 2018, 2022 9-33


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Model evaluation
• This stage refers to the use of Knowledge Studio tools to refine the model and improve
performance.
• Model evaluation involves the following activities:
1. Evaluating the results that are generated by the model against a test set of ground truth documents:
> Accuracy analysis to identify the causes of annotation errors.
> Headroom analysis to assess which errors require focus and where model refinements can yield the greatest
impact.

2. Reviewing the annotations that were added by the trained model to determine whether any
adjustments must be made to the model to improve its ability to find valid entity mentions, relation
mentions, and coreferences in the documents.
3. Making adjustments repeatedly to improve performance until a satisfactory level of accuracy is
achieved.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-27. Model evaluation

This stage refers to the use of Knowledge Studio tools to refine the model and improve
performance. The results that are generated by the model are evaluated against a test set of
ground truth documents.
• Accuracy analysis identifies the causes of annotation errors.
• Headroom analysis helps you assess which errors require focus and where model refinements
can yield the greatest impact.
After you determine areas in which the model is having trouble, take steps to improve its
performance.
Adjustments can be made repeatedly to improve performance until a satisfactory level of
accuracy is achieved.

© Copyright IBM Corp. 2018, 2022 9-34


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Model deployment
• This stage refers to exporting components that enable the model to run in machine learning
runtime environments and making the model accessible to other Watson applications.
• You can deploy the machine learning model for use by:
ƒ Watson Natural Language Understanding
ƒ Watson Discovery
• Model deployment involves the following activities:
1. Creating a snapshot of the current model.
2. Deploying the model to Watson Discovery or Watson Natural Language Understanding services

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-28. Model deployment

This stage refers to exporting components that enable the model to run in machine learning
runtime environments and making the model accessible to other Watson cognitive applications.
When you are satisfied with the performance of the model, you can leverage the machine learning
model that you trained with Knowledge Studio by making it available for use by:
• IBM Watson Natural Language Understanding service
• IBM Watson Discovery service
You can deploy or export a machine learning model. A dictionary or Natural Language
Understanding pre-annotator can be used only to pre-annotate documents within Knowledge
Studio.
Model deployment involves the following activities:
1. Creating a snapshot of the current model. This versions the model, which enables you to
deploy one version, while you continue to improve the current version. The option to deploy
does not appear until you create at least one version.
2. Deploying the model to Watson Discovery or Watson Natural Language Understanding
services.

© Copyright IBM Corp. 2018, 2022 9-35


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

End-to-end domain adaptation wrap-up

Knowledge
curation

Ground truth Model


generation deployment

Model Model
development evaluation

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-29. End-to-end domain adaptation wrap-up

The following points summarize the end-to-end domain adaptation process with Watson
Knowledge Studio:
• Adapting an AI system to a new domain, requires an iterative process with continuous
improvements to increase the performance of the system. This iterative process aims to reach
a level of incremental accuracy performing activities such as adding new functionalities,
testing the system, identifying opportunities to improve the performance, doing headroom
analysis, and finding possible solutions for the most frequent errors. The process requires the
collaboration of domain experts, data scientists, natural language processing (NLP) experts,
and machine learning developers.
• The creation of a model is an iterative multiple-step process that involves several stages:
knowledge curation, ground truth generation, model development, model evaluation, and
model deployment to runtime environments.
• Some tasks are performed outside Knowledge Studio and involve human experts to perform
activities to ensure that the collected data that will be used to train the model is relevant to
the domain, of high quality, and includes the right number of representative documents.

© Copyright IBM Corp. 2018, 2022 9-36


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty
• Knowledge Studio provides tools and artifacts to:
▪ Guide human annotators while performing manual annotations.
▪ Pre-annotate documents to bootstrap human annotations.
▪ Evaluate annotations by multiple human annotators and generate the ground truth for your
domain.
▪ Create models.
▪ Evaluate the performance of the trained model.
▪ Deploy the model to Watson Discovery and Watson Natural Language Understanding.
• Domain adaptation is a continuous improvement process, which requires an ongoing effort to
improve the performance of the model. Domain adaptation is the primary purpose of
Knowledge Studio.

© Copyright IBM Corp. 2018, 2022 9-37


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Unit summary • Describe IBM Watson Knowledge Studio.


• List the Watson services that are trained by Knowledge Studio.
• List the Knowledge Studio workspace resources.
• Explain the process to build Knowledge Studio models that can be
deployed and used with other Watson services.

© Copyright IBM Corporation 2018, 2022

Figure 9-30. Unit summary

© Copyright IBM Corp. 2018, 2022 9-38


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Review questions
1. True or False: Rule-based models are efficient for complex text extraction that has variations.
2. True or False: In Watson Knowledge Studio, machine learning models are used for complex
text extraction that has variations.
3. The following Watson service cannot be trained by using Knowledge Studio.
a. Watson Assistant
b. Watson Natural Language Understanding
c. Watson Discovery

4. True or False: A ruled based model can be used to pre-annotate documents to speed up the
human annotation process.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-31. Review questions

© Copyright IBM Corp. 2018, 2022 9-39


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Review questions (cont.)

5. ____ groups words and phrases that should be treated equivalently by a model.
a. Ruled-based model
b. Ground truth
c. Dictionary
d. Machine learning model
e. Type system

6. ___ is a collection of vetted data used to adapt a Watson solution to a particular domain.
a. Ruled-based model
b. Ground truth
c. Dictionary
d. Machine learning model
e. Type system
Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-32. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 9-40


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Review answers
1. True or False: Rule-based models are efficient for complex text extraction that has
variations.
2. True or False: In Watson Knowledge Studio, machine learning models are used for complex
text extraction that has variations.
3. The following Watson service cannot be trained by using Knowledge Studio.
a. Watson Assistant
b. Watson Natural Language Understanding
c. Watson Discovery

4. True or False: A ruled based model can be used to pre-annotate documents to speed up the
human annotation process.

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-33. Review answers

1. False. Rule-based models are efficient for recognizing patterns in unstructured data. Machine

learning models are efficient for complex text extraction.

© Copyright IBM Corp. 2018, 2022 9-41


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Review answers (cont.)


5. ____ groups words and phrases that should be treated equivalently by a model.
a. Ruled-based model
b. Ground truth
c. Dictionary
d. Machine learning model
e. Type system

6. ___ is a collection of vetted data used to adapt a Watson solution to a particular domain.
a. Ruled-based model
b. Ground truth
c. Dictionary
d. Machine learning model
e. Type system

Introduction to IBM Watson Knowledge Studio © Copyright IBM Corporation 2018, 2022

Figure 9-34. Review answers (cont.)

© Copyright IBM Corp. 2018, 2022 9-42


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty
Exercise: Creating a machine learning model with Watson
Knowledge Studio

Figure 9-35. Exercise: Creating a machine learning model with Watson Knowledge Studio

© Copyright IBM Corp. 2018, 2022 9-43


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 9. Introduction to IBM Watson Knowledge Studio

Uempty

Exercise • This exercise helps you understand the process for building a
machine learning model that you can later deploy and use with other
objectives Watson services.
• After completing this exercise, you should be able to:
ƒ Create a workspace for Knowledge Studio.
ƒ Configure the workspace resources.
ƒ Create document sets.
ƒ Pre-annotate documents.
ƒ Create tasks for human annotators.
ƒ Analyze the inter-annotator agreement and adjudicate conflicts.
ƒ Create machine learning models.

© Copyright IBM Corporation 2018, 2022

Figure 9-36. Exercise objectives

© Copyright IBM Corp. 2018, 2022 9-44


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Unit 10.Introduction to chatbots


Estimated time
00:30

Overview
This unit provides a high level introduction to chatbots, chatbot applications, and guidelines to
consider when designing a chatbot.

© Copyright IBM Corp. 2018, 2022 10-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Unit objectives • Explain what a chatbot is.


• Describe the common applications of chatbots.
• Identify factors that drive the growing popularity of chatbots.
• Recognize the guidelines to consider when designing a chatbot .
• List examples of tools and services that you can use to create
chatbots.

© Copyright IBM Corporation 2018, 2022

Figure 10-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 10-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Topics • Chatbots overview


• Chatbots design
• Chatbots tools and services

© Copyright IBM Corporation 2018, 2022

Figure 10-2. Topics

© Copyright IBM Corp. 2018, 2022 10-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty
10.1.Chatbots overview

© Copyright IBM Corp. 2018, 2022 10-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbots overview

Figure 10-3. Chatbots overview

© Copyright IBM Corp. 2018, 2022 10-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

What is a chatbot
• Software that interacts with the user in natural language.
• The application can have a chat interface.
• The conversation medium may be in text, speech, or both.
• Some example applications are customer support, sales activities, or entertainment.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-4. What is a chatbot

A chatbot is software that interacts with the user through a chat interface by using natural
language. The conversation might be in text, speech, or both. The chatbot chats with the user to
assist with applications like customer support, sales activities, or entertainment.

© Copyright IBM Corp. 2018, 2022 10-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbots in the industry


• Apple Siri, Microsoft Cortana, Google Assistant, and Amazon Alexa:
ƒ Interact by using natural language and often in the form of speech.
ƒ Support functions like setting alarms, running searches, and retrieving real-time information like news.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-5. Chatbots in the industry

There are many examples of chatbots:


Siri: The intelligent assistant of Apple iPhone. Siri can help you with your schedule and find the
nearest restaurant or movies that are available to watch.
Microsoft Cortana: Supported on various Microsoft Windows platforms. Also supported on
Android and iOS. It can set reminders and answer questions by using information from the Bing
search engine.
Google Assistant: Available on mobile and smart home devices. It provides the same functions
that Google does: Searches the internet, schedules events and alarms, adjusts hardware settings
on the user's device, and shows information from the user's Google account.
Amazon Alexa: Plays music and audiobooks, supports to-do lists, sets alarms, provides news and
other real-time information like weather updates, traffic, and sports. Alexa can also control
different smart devices that are part of a home automation system. You can give voice commands
to control your home automation system like “Alexa, turn off the light in the living room.”.
References:
Google Assistant
https://en.wikipedia.org/wiki/Google_Assistant
Cortana
https://en.wikipedia.org/wiki/Cortana
Amazon Alexa
https://en.wikipedia.org/wiki/Amazon_Alexa

© Copyright IBM Corp. 2018, 2022 10-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbots in the industry (cont.)


• IBM Watson Assistant is tailored for domain-specific use cases.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-6. Chatbots in the industry (cont.)

Another example of a chatbot is one that supports customers with their inquiries or even helps
junior customer support agents with their job. IBM uses Watson technology (Watson Assistant) to
create chatbots for those purposes.

© Copyright IBM Corp. 2018, 2022 10-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot history
• Bots passing the Turing test.
• ELIZA and PARRY did not use speech.
• SmarterChild was the predecessor to Siri, and was created by ActiveBuddy, Inc.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-7. Chatbot history

1950s: The Turing test


The Turing test by Alan Turing was introduced as a standard of intelligence.
The standard is based on the capability of the computer program to impersonate or mimic a
human in real time through a written conversation with a human judge. If the judge cannot
distinguish between the program and a real human based on the conversation alone, the program
passes the Turing test. Many programmers took the Turing test as a challenge.
1966: ELIZA
In 1966, Metzenbaum’s program ELIZA tricked users into believing that they were having a
conversation with a human. ELIZA passed the Turing test.
1972: PARRY
Another chatbot was invented around 1972 that was called PARRY. PARRY was more advanced
than ELIZA. However, both ELIZA and PARRY could have a conversation only through text (not
speech). Advances in natural language processing have led to the emergence of more capable
chatbots since then.
2001: SmarterChild
In 2001, SmarterChild emerged. It was a chatbot that was used across SMS networks. It took
advantage of the popularity of SMS and added the capability to understand natural language. It
relied on database access for news, sports, entertainment, and other various topics. It is
considered the precursor to Siri.
2006: IBM Watson
In 2006, IBM Watson started initial test runs. In 2011, Watson competed on the Jeopardy! quiz TV
show. It understood and answered trivia questions, and won against human contestants (the
Jeopardy! champions).

© Copyright IBM Corp. 2018, 2022 10-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty
2010: Siri
Siri emerged in 2010 as a personal assistant feature of Apple iOS. Siri can search for answers on
the web, create reminders, alarms, and events, call people, and much more.
2012: Google Now
In 2012, Google Now emerged, appearing as a feature in Google search. It delivered information
to users based on predictions of what they might be interested in knowing.
2015: Amazon Alexa and Microsoft Cortana
In 2015, Amazon Alexa, the virtual assistant behind Amazon Echo, and Microsoft Cortana
emerged.
2016: Chatbots
Facebook started a messaging platform enabling developers to create chatbots that can interact
with Facebook users. Today, there are more than 33,000 chatbots on Facebook Messenger alone.

© Copyright IBM Corp. 2018, 2022 10-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Why now
• Rising popularity and high usage of messenger applications, such as WhatsApp, Facebook
Messenger, and Slack
• Recent breakthroughs in the AI field
• Advancements in speech recognition
• Growing popularity of cloud computing and APIs

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-8. Why now

It seems that chatbots have become popular in recent years. Why now?
There are different reasons for the increase in the prevalence of chatbot:
• Rising popularity and high usage of messenger applications, such as WhatsApp, Facebook
Messenger, and Slack.
• Recent breakthroughs in the AI field make it possible to develop intelligent chatbots that can
communicate with users in human language and learn from their interaction with users.
Chatbots can learn over time to provide more accurate and intelligent responses.
• Advancements in speech recognition make it possible to take human speech as input and
enable users to have more natural interaction with computers.
• The growing popularity of cloud computing and APIs that provide integration capabilities
make it possible for AI vendors to make AI services easily available to developers on the
cloud. Developers can integrate chatbots into various applications and ensure reliable
communication between the chatbot and the application by using APIs.

© Copyright IBM Corp. 2018, 2022 10-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Popular chatbots
• DoNotPay chatbot for legal advice by Joshua Browder.
• Joshua Browder was named “Robin Hood of the internet” by the BBC.
• He used the IBM Watson Assistant service to improve the chatbot’s accuracy by 30%.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-9. Popular chatbots

The DoNotPay chatbot is a popular chatbot. It was created by a 19-year old Stanford student who
is named Joshua Browder, whom is called “Robin Hood of the internet” by the BBC.
Browder used a natural language interface to gather the data that is needed to complete the form.
He also used the IBM Watson Assistant service to improve that chatbot’s accuracy by 30%.

© Copyright IBM Corp. 2018, 2022 10-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Popular chatbots (cont.)


• Woebot in the medical domain.
• “Create the experience of a therapeutic conversation for all of
the people that use the bot.”

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-10. Popular chatbots (cont.)

Woebot was created by a team of Stanford psychologists and AI experts.


Woebot uses short chat conversations, sentiment and tone analysis, and word games to help
people who are looking for inexpensive therapy. The mission of the creators of Woebot is “to
make mental health radically accessible to everyone”.
Woebot uses a combination of natural language processing, therapeutic expertise, personalized
content, and a sense of humor to “create the experience of a therapeutic conversation for all of
the people that use the bot.”

© Copyright IBM Corp. 2018, 2022 10-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty
10.2.Chatbots design

© Copyright IBM Corp. 2018, 2022 10-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbots design

Figure 10-11. Chatbots design

© Copyright IBM Corp. 2018, 2022 10-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot design
• The basic goals of conversational interaction for chatbots are:
• Help users.
• Manage user expectations.
• Achieve the purpose of the solution.
• Keep the user engaged.
• Extract insights about the users.
• Reinforce the brand of the client.
• Increase sympathy and forgiveness in users.
• Make the solution look clever.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-12. Chatbot design

Conversational interaction in the chat between the chatbot and the user takes place by
exchanging natural language messages. Conversational interaction has an important role to play
because it must help the customer understand how the chatbot can help them while managing
expectations.
It is important to design the conversation correctly and appropriately for the type of chatbot
solution and target audience. Not all solutions need the same amount of conversational
interaction, but if you do not deliberately design the conversational interaction, you will not fully
realize the potential of the solution to address the needs of your clients. If clients do not see
enough value from the chatbot solution, they are unlikely to continue to use it.
The basic goals of conversational interaction are:
• How to help users and manage their expectations.
• Help achieve the purpose of the solution and drive value.
• Encourage the user to keep using the chatbot.
• Derive usable insights about the users.
• Reinforce the brand of the client.
• Increase sympathy and forgiveness in users.
• Make the solution look clever.

© Copyright IBM Corp. 2018, 2022 10-16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty
To achieve these goals, the dialog must be carefully designed to use the appropriate language and
a suitable approach. Designing the chatbot is the part that is most removed from development.
The result of this design is the overall impression of the chatbot on the user.
Here are key factors to consider in the conversational design:
• Positioning
• Tone and personality

© Copyright IBM Corp. 2018, 2022 10-17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot design: Positioning


Positioning
The positioning of the chatbot is a collective term that covers these three aspects:
• Purpose
• Viewpoint
• Proactivity

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-13. Chatbot design: Positioning

To achieve your chatbot design goals, you must define different aspects about how to design your
chatbot .
The first concept to consider is positioning. Positioning determines how the solution should relate
to the user, and behave when interacting with the user. The positioning of the chatbot is a
collective term that covers these three aspects:
• Purpose
• Viewpoint
• Proactivity

© Copyright IBM Corp. 2018, 2022 10-18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot design: Positioning (cont.)


Purpose: What is the purpose of the solution?
Examples:
• Clarify or answer the user’s questions.
• Guide users to find the information they are looking for.
• Help users to complete a process.
• Collect the information that is needed to report a problem.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-14. Chatbot design: Positioning (cont.)

Purpose: What is the purpose of the solution?


A conversational interaction should always have a clear purpose, that is, a well-defined job to do.
For example:
• Clarify or answer the user’s questions.
• Guide users to find the information they are looking for.
• Help users to complete a process.
• Collect the information that is needed to report a problem.
The purpose is the “job description” of the chatbot.
Chatbots, unlike standard application UI, tend to humanize interactions and they should be
tailored to the needs of the users.

© Copyright IBM Corp. 2018, 2022 10-19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot design: Positioning (cont.)


• Viewpoint: What role should the solution play in the relationship between the client and the
user?
• Examples: Assistant, friend, coach, motivator, salesperson, and others

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-15. Chatbot design: Positioning (cont.)

Viewpoint:
Viewpoint is the role that the chatbot solution should adopt in relation to the end user. As a
designer, ask yourself:
• Who is the audience? (for example, students, prospect clients, users of your product, tourists,
and so on)
• Who does the chatbot speak on behalf of? (for example, an employee who speaks on behalf of
the company, as an advocate or friend to the user who speaks on behalf of the tourism
organization, a tutor or teacher who speaks on behalf of a school or university, and so on.)
The relationship that the bot will have with the user should be decided upon in light of achieving
the purpose previously determined: Does the chatbot represent a salesperson? an entertainer? a
teacher? an enforcer or regulator? a companion or friend?
Viewpoint can be determined through these questions:
• What role should the solution play in the relationship between the client and the user?
• Should the chatbot present itself as an employee who speaks on behalf of the client and is
aligned with the client interests?
• Should the chatbot present itself as an advocate or friend to the user who can access the
client’s information to help the user?

© Copyright IBM Corp. 2018, 2022 10-20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty
Some examples of roles or viewpoint are:
• Assistant
• Friend
• Coach
• Motivator
• Salesperson
Another question is, who is the audience? Are they students, prospect clients, users of a product,
or others?

© Copyright IBM Corp. 2018, 2022 10-21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot design: Positioning (cont.)


Proactivity:
• Level of proactiveness or reactiveness when engaging with user.
• A chatbot can be:
ƒ Proactive (lean forward): The chatbot reaches out to the user and asks questions.
ƒ Reactive (lean backward): The chatbot waits for the user to ask a question.
ƒ Combination: The chatbot uses both techniques.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-16. Chatbot design: Positioning (cont.)

Proactivity is the degree to which the solution proactively engages and guides the user instead of
reacting to the user, that is, waiting for the user to ask a question.
A chatbot can be:
• Proactive: The chatbot reaches out to the user by asking questions, offering information and
choices, and guiding the user through processes.
• Reactive: Apart from a welcome message (and perhaps one or two other statements), your
chatbot waits for the user to ask a question. It does not prompt, encourage, or suggest.
• Combination: In specific circumstances, the chatbot reaches out to the user, asking questions
and guiding the user through processes. At other times, the chatbot waits for the user to ask a
question.

© Copyright IBM Corp. 2018, 2022 10-22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot design: Positioning (cont.)


• Example of a proactive chatbot:
ƒ Customer: When can I receive my new credit card?
ƒ Chatbot: An SMS will be sent to your phone after it is ready.
ƒ Chatbot: The bank is collaborating with XYZ to provide benefits to our credit card users. Would you be
interested in knowing more?

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-17. Chatbot design: Positioning (cont.)

Imagine a scenario where a chatbot is acting as a customer service employee on behalf of a bank.
The following conversation represents a proactive chatbot:
• Customer: When can I receive my new credit card?
• Chatbot: An SMS will be sent to your phone after it is ready.
• Chatbot: The bank is collaborating with XYZ to provide benefits to our credit card users. Would
you be interested in knowing more?
The chatbot answers when asked, but also reaches out to the customer and offers suitable
suggestions.

© Copyright IBM Corp. 2018, 2022 10-23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot design: Positioning (cont.)


• Example of a reactive chatbot:
ƒ Customer: When can I receive my new credit card?
ƒ Chatbot: An SMS will be sent to your phone after it is ready.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-18. Chatbot design: Positioning (cont.)

The following conversation represents a reactive chatbot:


• Customer: When can I receive my new credit card?
• Chatbot: An SMS will be sent to your phone after it is ready.
The chatbot waits for the customer’s question, and answers only when asked.

© Copyright IBM Corp. 2018, 2022 10-24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot design: Tone and personality


• Represents the voice in which the chatbot solution speaks.
• Examples:
ƒ Informal and friendly tone: “Hi there, how can I help you?”
ƒ More formal, still friendly: “Good morning. How may I help you today?
ƒ Formal, not very friendly: “This is a service that is designed to answer your questions. How may I assist
you with your inquiries?”

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-19. Chatbot design: Tone and personality

Tone and personality: Represents the voice in which the chatbot solution speaks. Do not confuse
tone and personality with viewpoint, which is whom the chatbot speaks on behalf.
Examples:
• Informal and friendly tone: “Hi there, how can I help you?”
• More formal, still friendly: “Good morning. How may I help you today?”
• Formal, not very friendly: “This is a service that is designed to answer your questions. How
may I assist you?”

© Copyright IBM Corp. 2018, 2022 10-25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot design: Tone and personality (cont.)


• What happens if you do not define tone and personality?
• The chatbot will still have them, but it likely will be incoherent, which leads to a random user
experience.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-20. Chatbot design: Tone and personality (cont.)

What happens if you do not define tone and personality?


All verbal expression has a tone, all conversation is held between two sides, with someone, or
something with a personality in mind.
If you do not define tone and personality, the chatbot will still have them, but if they are not
deliberately and explicitly determined the chatbot likely will be incoherent, which leads to a
random user experience.

© Copyright IBM Corp. 2018, 2022 10-26


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot design: Tone and personality (cont.)


• You can construct a complete character persona for your chatbot .
• A common feature that is often in chatbots is humor.
• Humor increases the user's understanding, forgiveness, and satisfaction.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-21. Chatbot design: Tone and personality (cont.)

You should determine the kind of personality that your users like better or feel more comfortable
interacting with when designing your chatbot.
Personality is affected by the choice of words for the chatbot’s responses.
You can construct a complete character persona for your chatbot.
A common feature that is often in chatbots is humor. Humor can increase the user's
understanding and forgiveness when your chatbot cannot understand something. It might even
delight the user and increase their satisfaction with the chatbot.

© Copyright IBM Corp. 2018, 2022 10-27


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot design: Tone and personality for purpose


• Example 1: If the purpose is to engage users proactively and encourage them to act, a
friendly, informal tone will be more successful than a formal or authoritative tone.
• Example 2: If the purpose is to provide information or guidance about a serious topic, a
casual, chatty tone might undermine the credibility of the information that is provided.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-22. Chatbot design: Tone and personality for purpose

Here are two examples of tone and personality for the purpose:
• If the purpose is to engage users proactively and encourage them to act, a friendly, informal
tone will be more successful than a formal or authoritative tone.
• If the purpose is to provide information or guidance about a serious topic, a casual, chatty tone
might undermine the credibility of the information that is provided.

© Copyright IBM Corp. 2018, 2022 10-28


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot design: Tone and personality for viewpoint


• Example 1: If the viewpoint is that of an employee, the tone and personality should closely
reflect the client’s ideal staff member.
• Example 2: If the viewpoint is that of a partially or fully independent advocate or guide for the
user, then the tone and personality should not be that of enforcer or authority figure. Instead,
it should be more like an advisor, assistant, or coach.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-23. Chatbot design: Tone and personality for viewpoint

Here are some examples for tone and personality for viewpoint:
• If the viewpoint is that of an employee, the tone and personality should closely reflect the
client’s ideal staff member.
• If the viewpoint is that of a partially or fully independent advocate or guide for the user, then
the tone and personality should not be that of enforcer or authority figure. Instead, it should
be more like an advisor, assistant, or coach.

© Copyright IBM Corp. 2018, 2022 10-29


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot design: Tone and personality for proactivity


• If the solution is highly proactive, either an overly formal or overly casual and chatty tone may
have an unpleasant effect because the former might feel artificial and the latter is likely to
become annoying.
• Tone and personality for special cases: If a response uses offensive language:
í The chatbot can shift to an “enforcer” viewpoint and adopt a more formal tone.
í You may keep a count of the number of sensitive inputs and respond with an increasingly strong-
worded response.
í You may shut down the chat (in the case of threats and offensive language).

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-24. Chatbot design: Tone and personality for proactivity

If the solution is highly proactive, either an overly formal or overly casual and chatty tone may
cause a negative reaction because the former might feel artificial and the latter is likely to become
annoying.
Consider the appropriate tone and personality for special cases. There might be special cases
where the tone response might differ from the rest of the solution. For example, if there are
responses that use offensive language:
• The chatbot can shift to an “enforcer” viewpoint and adopt a more formal tone.
• You may keep a count of the number of sensitive inputs and respond with an increasingly
strong-worded response.
• You may shut down the chat (in the case of threats and offensive language).

© Copyright IBM Corp. 2018, 2022 10-30


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbot design: Design issues


1. Understand the limitations of a chatbot.
2. Acknowledge limitations and do not be afraid to have the chatbot say, “I don’t know”, and
give some suggestions of questions that they can ask.
3. Handle frustration. “I can see this isn’t going very well. Would you like to talk to a real
person?”

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-25. Chatbot design: Design issues

Some of the issues that developers or designers face while designing chatbots include the
following ones:
1. Trying to do too much within a single chatbot, which can lead to a loss of value: You must
understand the limitations of a chatbot. It must have a narrow scope that is well-defined and
well-bounded. It is not a chitchat.
2. Users will be disappointed by incorrect or nonsensical responses: To avoid this issue,
acknowledge limitations and do not be afraid to have the chatbot say, “I don’t know”, and give
some suggestions of questions that they can ask.
3. Detect frustration, and handle it: If the users are frustrated, this issue should be addressed.
A good example response can be: “I can see that this isn’t going very well. Would you like to
talk to a real person?” Some interactions are too complex for a software solution to handle.
Detecting situations that are out of the scope of your chatbot and handing them off to a human
quickly (before you waste the user’s time) is a better approach.

© Copyright IBM Corp. 2018, 2022 10-31


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty
10.3.Chatbots tools and services

© Copyright IBM Corp. 2018, 2022 10-32


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbots tools and


services

Figure 10-26. Chatbots tools and services

© Copyright IBM Corp. 2018, 2022 10-33


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Chatbots tools and services


Here are examples of some available tools and services:
• IBM Watson Assistant
• Dialogflow
• Microsoft Language Understanding Intelligent Service (LUIS)
• ChatScript
• Chatfuel

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-27. Chatbots tools and services

You can create chatbots by using cognitive services to help you design how your chatbot
understands user’s input and replies to the user. You can also use software to configure a chatbot
that is already trained and programmed to answer specific questions from users in areas such as
customer support.
Here are examples of some available tools and services:
• IBM Watson Assistant.
• Dialogflow: Google-owned developer of human-computer interaction technologies that are
based on natural language conversations.
• Microsoft Language Understanding Intelligent Service (LUIS).
• ChatScript: Written in C++.
• Chatfuel: A platform for creating AI chatbots for Facebook.

© Copyright IBM Corp. 2018, 2022 10-34


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty
References:
chatfuel
https://chatfuel.com/
ChatScript
https://en.wikipedia.org/wiki/ChatScript
Dialogflow
https://dialogflow.com/
Dialogflow
https://en.wikipedia.org/wiki/Dialogflow
Language Understanding (LUIS)
https://www.luis.ai/

© Copyright IBM Corp. 2018, 2022 10-35


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Unit summary • Explain what a chatbot is.


• Describe the common applications of chatbots.
• Identify factors that drive the growing popularity of chatbots.
• Recognize the guidelines to consider when designing a chatbot .
• List examples of tools and services that you can use to create
chatbots.

© Copyright IBM Corporation 2018, 2022

Figure 10-28. Unit summary

© Copyright IBM Corp. 2018, 2022 10-36


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Review questions
1. True or False: If a chatbot provides information or guidance about a serious topic, then using
a casual, chatty tone is a recommended.

2. True or False: Advancements in NLP and AI are key factors in the emergence of chatbots.

3. True or False: A chatbot that reaches out to the user by asking questions and offering
information is considered reactive by design.

4. True or False: There are two types of viewpoint: lean forward and lean backward.

5. True or False: Chatbots reaching out to the user by asking questions are considered lean
forward chatbots.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-29. Review questions

1. False.
2. True.
3. False.
4. False.
5. True

© Copyright IBM Corp. 2018, 2022 10-37


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Review questions (cont.)


6. Represents the voice in which the chatbot solution speaks, for example, informal, friendly, or
formal.
a. Viewpoint
b. Purpose
c. Tone and personality
d. Positioning
e. Proactivity

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-30. Review questions (cont.)

6. C. Tone and personality.

© Copyright IBM Corp. 2018, 2022 10-38


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Review answers
1. True or False: If a chatbot provides information or guidance about a serious topic, then using
a casual, chatty tone is a recommended.

2. True or False: Advancements in NLP and AI are key factors in the emergence of chatbots.

3. True or False: A chatbot that reaches out to the user by asking questions and offering
information is considered reactive by design.

4. True or False: There are two types of viewpoint: lean forward and lean backward.
False: There are two types of proactivity: lean forward and lean backward.

5. True or False: Chatbots reaching out to the user by asking questions are considered lean
forward chatbots.

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-31. Review answers

1. False.
2. True.
3. False.
4. False. There are two types of proactivity: lean forward and lean backward.
5. True.

© Copyright IBM Corp. 2018, 2022 10-39


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 10. Introduction to chatbots

Uempty

Review answers (cont.)


6. Represents the voice in which the chatbot solution speaks, for example, informal, friendly, or
formal.
a. Viewpoint
b. Purpose
c. Tone and personality
d. Positioning
e. Proactivity

Introduction to chatbots © Copyright IBM Corporation 2018, 2022

Figure 10-32. Review answers (cont.)

6. C. Tone and personality.

© Copyright IBM Corp. 2018, 2022 10-40


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Unit 11.Introduction to IBM Watson


Assistant
Estimated time
01:30

Overview
This unit covers the core concepts that you need to understand to build a chatbot with IBM
Watson Assistant.

© Copyright IBM Corp. 2018, 2022 11-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Unit objectives • Describe the experiences available in Watson Assistant to build


chatbots.
• Describe the main components of new Watson Assistant.
• Explain how to build a chatbot with Actions and Steps.
• Describe the main components of classic Watson Assistant.
• Describe how to build a chatbot with Intent, Entities, and Dialog
Skills.
• Compare action-based conversations and dialog-based
conversations.
• Describe when and how to migrate from classic to new Watson
Assistant.
• Test a chatbot.
• Explain how to enrich a chatbot.

© Copyright IBM Corporation 2018, 2022

Figure 11-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 11-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Topics • Watson Assistant experiences


• New Watson Assistant
• Classic Watson Assistant
• Migrating to the new experience
• Enriching the chatbot

© Copyright IBM Corporation 2018, 2022

Figure 11-2. Topics

© Copyright IBM Corp. 2018, 2022 11-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
11.1.Watson Assistant experiences

© Copyright IBM Corp. 2018, 2022 11-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Watson Assistant
experiences

Figure 11-3. Watson Assistant experiences

© Copyright IBM Corp. 2018, 2022 11-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

About Watson Assistant experiences


• Use IBM Watson Assistant to build your own branded live chatbot, which is known as an
assistant, into any device, application, or channel.
• Watson Assistant provides two experiences to build assistants:
ƒ New Watson Assistant experience
ƒ Classic Watson Assistant experience

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-4. About Watson Assistant experiences

Use IBM Watson Assistant to build your own branded live chatbot, which is known as an assistant,
into any device, application, or channel.
Your chatbot, which is also known as an assistant, connects to the customer engagement
resources you already use to deliver an engaging, unified problem-solving experience to your
customers.
Watson Assistant provides two experiences to build assistants:
• New Watson Assistant experience
• Classic Watson Assistant experience

© Copyright IBM Corp. 2018, 2022 11-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

New Watson Assistant experience


• In October 2021, the new Watson Assistant became available.
• Watson Assistant was revamped to make it easier and faster to build, publish, and improve a
chatbot.
• The new Watson Assistant has a build experience that is tailored to the people who directly
interact with customers daily, such as customer service representatives and customer-care
experts.
• The new experience is focused on using actions to build customer conversations,
• Steps within the action represent back-and-forth interactions between your assistant and your
customer.
• The new Watson Assistant automatically handles things that might go wrong during a
conversation, such as topic changes, vague requests, misunderstandings, and asking for a
human agent.
• The new Watson Assistant navigation is more intuitive and follows the order of the steps that
are recommended to get your assistant live.
Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-5. New Watson Assistant experience

The new experience refers to the Watson Assistant build experience that was announced on
October 7, 2021.
Watson Assistant was revamped to make it easier and faster to build, publish, and improve a
chatbot.
The new Watson Assistant has a build experience that is tailored to the people who directly
interact with customers daily, such as customer service representatives and customer-care.
The new experience is focused on using actions to build customer conversations,
Steps within the action represent back-and-forth interactions between your assistant and your
customer.
The new Watson Assistant automatically handles things that might go wrong during a
conversation, such as topic changes, vague requests, misunderstandings, and asking for a human
agent.
The new Watson Assistant navigation is more intuitive and follows the order of the steps that are
recommended to get your assistant live.

© Copyright IBM Corp. 2018, 2022 11-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
References:
The new Watson Assistant announcement – October 7 2021
https://cloud.ibm.com/docs/assistant?topic=assistant-release-notes#assistant-oct072021
Welcome to the new Watson Assistant (documentation)
https://cloud.ibm.com/docs/watson-assistant
FAQs about the new IBM Watson Assistant experience
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-watson-assistant-faqs#f
aqs-new-experience
Comparing actions and dialog
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-comparing-actions-dialo
g
Migrating to the new experience
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-migrate-overview
Switching between new and classic experiences
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-switch-experience

© Copyright IBM Corp. 2018, 2022 11-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Classic Watson Assistant experience


• The classic experience refers to the Watson Assistant build experience that was available
before the new experience was announced in October 2021.
• The classic experience is built around the following concepts:
ƒ Skills
ƒ Intents
ƒ Entities
ƒ Dialog
• Customers that built their assistants by using the classic experience can migrate to the new
experience or remain in the classic experience.
• A dialog-based conversation is the best choice when you want greater control over the logic of
the flow.
• The dialog flow uses an if-then-else style structure that might be familiar to developers, but
not to content designers or customer-care experts.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-6. Classic Watson Assistant experience

The classic experience refers to the Watson Assistant build experience that was available before
the new experience was announced in October 2021.
No matter what the specific purpose of your chatbot is, some core fundamentals are always
involved:
• Skills
• Intents
• Entities
• Dialog
Each of these functions and their application to the Watson Assistant service are explained in
detail in the Classic Watson Assistant topic
The dialog component is optional because some chatbots are developed to answer user questions
in a question-and-answer manner that is similar to the approach that is used to answer frequently
asked questions (FAQs).
These chatbots need to understand only what the user is asking and reply with the proper answer.
Chatbots that are meant to answer FAQs do not have to engage in a conversation with the user
and therefore they do not need a dialog component.
Customers that built their assistants by using the classic experience can migrate to the new
experience or remain in the classic experience.
A dialog-based conversation is the best choice when you want greater control over the logic of the
flow.
The dialog flow uses an if-then-else style structure that might be familiar to developers, but not to
content designers or customer-care experts.

© Copyright IBM Corp. 2018, 2022 11-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
References:
About Watson Assistant
https://cloud.ibm.com/docs/assistant?topic=assistant-index
Migrating to the new experience
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-migrate-overview
Comparing actions and dialog
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-comparing-actions-dialo
g
Switching between new and classic experiences
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-switch-experience
FAQ
https://cloud.ibm.com/docs/assistant?topic=assistant-faqs

© Copyright IBM Corp. 2018, 2022 11-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
11.2.New Watson Assistant

© Copyright IBM Corp. 2018, 2022 11-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

New Watson
Assistant

Figure 11-7. New Watson Assistant

New Watson Assistant documentation https://cloud.ibm.com/docs/watson-assistant


Watson Assistant blog https://www.ibm.com/blogs/watson/

© Copyright IBM Corp. 2018, 2022 11-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

The new Watson Assistant


• The new Watson Assistant experience is focused on using actions to build customer
conversations.
ƒ New navigation provides a workflow for building, previewing, publishing, and analyzing your assistant.
ƒ Each assistant has a home page with a task list to help you get started.
ƒ Build conversations with actions, which represent the tasks that you want your assistant to help your
customers with.
í Each action contains a series of steps that represent individual exchanges with a customer.
ƒ When you publish, you can review and debug your work in a draft environment before you go live to
your customers.
ƒ Use a new suite of analytics to improve your assistant.
í Review which actions are being completed to see what your customers want help with, determine
whether your assistant understands and addresses customer needs, and decide how can you make
your assistant better.
• Switching the experience
ƒ You can easily switch back and forth between the new experience and the classic experience.
Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-8. The new Watson Assistant

The new Watson Assistant experience is focused on using actions to build customer
conversations. It is designed to make it simple enough for anyone to build a virtual assistant.
Building, testing, publishing, and analyzing your assistant can all now be done in one simple and
intuitive interface.
New navigation provides a workflow for building, previewing, publishing, and analyzing your
assistant.
• Each assistant has a home page with a task list to help you get started.
• Build conversations with actions, which represent the tasks that you want your assistant to
help your customers with.
▪ Each action contains a series of steps that represent individual exchanges with a customer.
• When you publish, you can review and debug your work in a draft environment before you go
live to your customers.
• Use a new suite of analytics to improve your assistant.
▪ Review which actions are being completed to see what your customers want help with,
determine whether your assistant understands and addresses customer needs, and
decide how can you make your assistant better.
Switching the experience
You can easily switch back and forth between the new experience and the classic experience.
However, the new experience provides a simplified user interface, an improved deployment
process, and access to the latest features.

© Copyright IBM Corp. 2018, 2022 11-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
References:
Welcome to the new Watson Assistant
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-welcome-new-assistant
Watson Assistant documentation
https://cloud.ibm.com/docs/watson-assistant
FAQs about the new IBM Watson Assistant experience.
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-watson-assistant-faqs#f
aqs-new-experience
Getting started with Watson Assistant
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-getting-started
Migrating to the new experience.
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-migrate-overview
Switching between new and classic experiences
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-switch-experience

© Copyright IBM Corp. 2018, 2022 11-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Building your assistant with Action and Step


• Like a human personal assistant, the assistant you
build helps your customers perform tasks and answer
questions. To accomplish this, you define actions for
the assistant.
• What is an Action?
ƒ An action is a problem or a task that your customer wants
to resolve. For example, paying a bill, getting an invoice,
getting the balance in a bank account, withdrawing
money, saying hello, or asking about the weather might all
be an action in your assistant.
• What is a Step?
ƒ A step is a back-and-forth interaction between your
assistant and your customer.
ƒ Steps represent the clarification questions, final answers,
or human agent handoff points in the action.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-9. Building your assistant with Action and Step

Like a human personal assistant, the assistant you build helps your customers perform tasks and
answer questions. To accomplish this, you define actions and steps for the assistant.
An action is a problem or a task that your customer wants to resolve. For example, paying a bill,
getting an invoice, getting the balance in a bank account, withdrawing money, saying hello, or
asking about the weather might all be an action in your assistant.
An action represents a discrete outcome that you want your assistant to be able to accomplish in
response to a user's request. An action comprises the interaction between a customer and the
assistant about a particular question or request. This interaction begins with the user input that
starts the action (for example, ”I want to withdraw money”). It might then include additional
exchanges as the assistant gathers more information, and it ends when the assistant carries out
the request or answers the customer's question.
A step is a back-and-forth interaction between the assistant and the customer.
Steps represent the clarification questions, final answers, or human agent handoff points in the
action.
Everything else that the step needs to function like the flow logic, response options, or storage of
the user’s response is contained within the step.
In the example that is shown in the slide, the assistant asks clarification questions before it hands
the conversation over to an agent (with the account number as context) for a cable bill. For
internet or phone bills the assistant guides the user to the online billing portal.

© Copyright IBM Corp. 2018, 2022 11-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
An action consists of one or more steps. The steps in an action define the conversation turns that
follow the initial customer input that triggered the action. In a simple case, a step might consist of
a direct answer to a question from the customer; for example, if the customer asks “What are your
business hours?”, a one-step action might reply with “We are open Monday through Friday from 9
AM to 5 PM”.
More commonly, an action requires multiple steps to fully understand the customer's request. For
the example, If the customer says “I want to pay my cable bill” the assistant needs more
information such as “what is your account number?” Each of these follow-up questions
represents a step in the action.

Information

For step-by-step instructions on the Billing Assistant scenario that is described in this
presentation, see the tutorial “Getting Started with the New Watson Assistant: The Build Guide
Part I” at
https://www.ibm.com/blogs/watson/2021/12/getting-started-with-the-new-watson-assistant-p
art-i-the-build-guide/

References:
Getting Started with the New Watson Assistant: The Build Guide Part I
https://www.ibm.com/blogs/watson/2021/12/getting-started-with-the-new-watson-assistant-p
art-i-the-build-guide/
Getting Started with the new Watson Assistant: Plan It
https://www.ibm.com/blogs/watson/2021/11/getting-started-with-the-new-watson-assistant-p
lan-it/
Overview: Editing actions
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-build-actions-overview

© Copyright IBM Corp. 2018, 2022 11-16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Actions benefits
• Using actions is the best choice when you want to approach the assistant with a focus on
content.
• The process of creating a conversational flow is easier. People who have expertise with
customer care can write the words that your assistant says.
• Actions provide better visibility into the customer's interaction and satisfaction with the
assistant.
• The conversation designer doesn't have to manage data collected during the conversation. By
default, your assistant collects and stores information for the duration of the current action.
• Many people can work at the same time in separate, self-contained actions. The order of
actions within a conversation doesn't matter.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-10. Actions benefits

Using actions is the best choice when you want to approach the assistant with a focus on content.
Actions offers the following benefits:
• The process of creating a conversational flow is easier. People who have expertise with
customer care can write the words that your assistant says. With a simplified process anyone
can build a conversation. You don't need knowledge about machine learning or programming.
• Actions provide better visibility into the customer's interaction and satisfaction with the
assistant. Because each task is discrete and has a clear beginning and ending, you can track
user progress through a task and identify snags.
• The conversation designer doesn't have to manage data collected during the conversation. By
default, your assistant collects and stores information for the duration of the current action.
You don't need to take extra steps to delete saved data or reset the conversation. But if you
want, you can store certain types of information, such as the customer's name, for the
duration of a conversation.
• Many people can work at the same time in separate, self-contained actions. The order of
actions within a conversation doesn't matter. Only the order of steps within an action matters.
And the action author can use drag and drop to reorganize the steps in the action for optimal
flow.
Reference:
Comparing actions and dialog
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-comparing-actions-dialo
g

© Copyright IBM Corp. 2018, 2022 11-17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Creating your first assistant


1. Create a Watson Assistant 1
service instance.
2. Launch the Watson assistant
tool.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-11. Creating your first assistant

To create your first assistant, complete these steps:


1. Create a Watson Assistant service. You can use an existing Watson Assistant service if you
already have one.
2. After you create the service instance, the dashboard for the instance opens. Click Launch
Watson Assistant to open the tool and create your assistant.

© Copyright IBM Corp. 2018, 2022 11-18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Creating your first assistant (cont.)


3. Create your assistant. Example, 3
Billing Assistant.
4. The assistant Home page opens.
4

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-12. Creating your first assistant (cont.)

3. Give your assistant a name that describes the group of topics it covers. In this example, Billing
Assistant. Choose the language it uses to respond to your customers and click Create
assistant.
4. The Home page of your assistant is displayed.

© Copyright IBM Corp. 2018, 2022 11-19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Creating your first Action


• Actions represent the topics that your assistant can
handle, for example “pay bill”.
• Enter an example of the customer interaction. You
“train” your assistant’s topic-recognition AI by
giving it example sentences.
ƒ When you create a new action, you are prompted to
provide the first example like “I want to pay my cable
bill please”.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-13. Creating your first Action

Actions represent the tasks or questions that your assistant can help customers with. Each action
has a beginning and an end, making up a conversation between the assistant and a customer.
When you create a new action, Watson Assistant prompts you for an example of the customer’s
input that starts the action.
1. From the navigation panel on the left click Actions to create a new action and then click
Create a new action.
2. In the “New action” window, at the prompt "What does your customer say to start this
interaction?", type an example of your customers interactions for this action. In this example,
“I want to pay my cable bill please”.

© Copyright IBM Corp. 2018, 2022 11-20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Creating your first Step – Step 1


1. Add a step to ask a clarification
question, for example, the type of
account, which has a bill that
needs to be paid. Step 1 is created
by default.
2. Add the clarification question in
the “Assistant says” text box.
3. Select the type of customer
response that the assistant should
wait for. In this case, Options is
the best choice.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-14. Creating your first Step – Step 1

Now it’s time to create the first step in the bill pay interaction.
1. Step 1 is already created for you.
2. Select the step to edit it and add the clarification question in the “assistant says” text box. In
this example, “What type of account are we talking here?”.
3. Then, select the type of customer response that the assistant should wait for. In this case,
Options is the best choice.

© Copyright IBM Corp. 2018, 2022 11-21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Creating your first Step – Step 1 (cont.)


4. Add the three options for Cable, Internet, and Phone, and apply your changes.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-15. Creating your first Step – Step 1 (cont.)

4. Add the three options for Cable, Internet, and Phone, and apply your changes.
Finally, the first step looks as shown in the figure on the right.

© Copyright IBM Corp. 2018, 2022 11-22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Trying out your action


• Click Try it to preview your action to make
sure it works.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-16. Trying out your action

Now preview your action to make sure it works.


Click Try it in the lower right of your screen. Try out a few interactions and see that it properly
recognizes what you ask it. Try typing something other than what you used as your training
sentence.

© Copyright IBM Corp. 2018, 2022 11-23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Adding more steps to the conversation – Step 2


• Add a step to ask a clarification
question, for example, the
account number.
1. Click New step
2. Add the clarification question
What’s your account number?
3. Select Number for the type of
customer response.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-17. Adding more steps to the conversation – Step 2

The steps in an action define the conversation turns that follow the initial customer input that
triggered the action. In a simplest case, a step might consist of a direct answer to a question from
the customer; for example, if the customer asks. What are your business hours?, a one-step action
might reply with “We are open Monday through Friday from 9 AM to 5 PM”.
Usually, an action requires multiple steps to fully understand the customer's request.
For example, if the customer wants to pay a bill, the assistant needs to know the account number.
If the customer asks, “I want to withdraw money”, the assistant needs more information:
• Which account should the money come from?
• What is the amount to withdraw?
Each of these follow-up questions represents a step in the action.
In this example:
1. Add Step 2 below Step 1 by clicking New step.
2. In the “Assistant says” field, type the clarification question to ask for the account number,
“What’s your account number?”.
3. Select Number from the response drop-down list as the type of customer response.

© Copyright IBM Corp. 2018, 2022 11-24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Adding logic (conditions) to the flow – Step 2


• In this example, the
customer should be
prompted for an account
number only for cable bills.
• Add a condition to Step 2.
ƒ Step 2 is taken with
conditions.
ƒ Condition: answer to step 1
= Cable but not Internet or
Phone.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-18. Adding logic (conditions) to the flow – Step 2

Next, you need to add some flow logic to the flow. In this example, given the way that this flow
works, an account number should be gathered only for cable bills. To handle this scenario, you
need to add a condition to your step. To do that, change the step to be taken with conditions
instead of without.
Conditions are basically requirements, which must be met for the step to be triggered. In this
case, you want to condition on the answer to step 1 being “Cable” but not Internet or Phone. To
set it up, make sure that you have the condition set to step 1 = Cable.

© Copyright IBM Corp. 2018, 2022 11-25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Adding an agent handoff step – Step 3


1. Add step 3 under step 2.
2. Enter text related to getting the
user to an agent to pay their bill.
“Let me get you to an agent who
can help you pay your cable bill!.”
3. Condition step 3 on “step 1 =
Cable”.
4. For this step, you don’t need to
gather any information from the
user, so you can leave the Define
customer response section empty.
5. Change And then to Connect to
agent.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-19. Adding an agent handoff step – Step 3

Now, you need to add the last steps to provide the outcome to the user.
1. Add step 3 under step 2.
2. Enter some text related to getting the user to an agent to pay their bill. For example, “Let me
get you to an agent who can help you pay your cable bill!.”
3. Condition step 3 on “step 1 = Cable” as you did in step 2.
4. For this step, you don’t need to gather any information from the user, so you can leave the
“Define customer response” section empty.
5. Now, set up the assistant to route this conversation to a human agent. Change the And then
setting to Connect to agent (connect to a human agent), which also ends the action when it
hands off.

© Copyright IBM Corp. 2018, 2022 11-26


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Inserting the context to pass to the human agent – Step 3


• Insert the context that you gathered
for the human agent to review.
ƒ The customer wants to pay their Cable
bill.
ƒ The account number. Select step 2
(the account number) as the field that
you want to insert
ƒ Apply your changes.
Hint: To insert the content of the variables that you
collected into text, start with the “$” sign and a quick
select box appears as shown in the figure.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-20. Inserting the context to pass to the human agent – Step 3

In the prompt that comes up, you insert the context that you gathered for the human agent to
review. Namely, the fact that the customer wants to pay their Cable bill and the account number.

Hint

To insert the content of the variables that you collected into text, start with the “$” sign and a
quick select box appears as shown in the figure.

Insert the context that you gathered for the human agent to review.
• The customer wants to pay their Cable bill.
• The account number. Select step 2 (the account number) as the field that you want to insert
• Apply your changes.

© Copyright IBM Corp. 2018, 2022 11-27


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Handoff to agent step wrap-up – Step 3

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-21. Handoff to agent step wrap-up – Step 3

The slide shows the completed step 3, which derives the customer to a human agent and passes
the context that is collected from the user.

© Copyright IBM Corp. 2018, 2022 11-28


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Creating a final response – Step 4 (1 of 5)


• Add a final step to wrap up the
conversation. Step 4 tells the customer,
To pay your <type of bill> bill, you can
head to our online portal <link to portal>
• To insert a variable like the type of bill to
be paid, click the Insert a variable
button that is located over the text box.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-22. Creating a final response – Step 4 (1 of 5)

Add a final step to wrap up the conversation. Step 4 tells the customer, “To pay your <type of bill>
bill, you can head to our online portal <link to portal>”
To insert a variable like the type of bill to be paid, click the Insert a variable button that is located
over the text box.

© Copyright IBM Corp. 2018, 2022 11-29


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Creating a final response – Step 4 (2 of 5)


• To add a link to the text, highlight the text
that you want to use and then click the
Link button.
• Enter the URL in the “Insert link” window.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-23. Creating a final response – Step 4 (2 of 5)

To add a link to the text, highlight the text that you want to use and then click the Link button.
Enter the URL in the “Insert link” window.
The settings for the link look like the figure.

© Copyright IBM Corp. 2018, 2022 11-30


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Creating a final response – Step 4 (3 of 5)


• This step must run only
for an Internet or Phone
bills.
ƒ Create a condition on
“step 1 = Internet.”
ƒ Add another condition for
“step 1 = Phone.”
ƒ Ensure that the step runs
when Any of these
conditions are met.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-24. Creating a final response – Step 4 (3 of 5)

Next, make sure that this step only runs for an Internet or Phone bill. To accomplish this goal,
create a condition on “step 1 = Internet.” Then, add another condition for “step 1 = Phone.”
Ensure that this step is triggered when Any of these conditions are met (not All of them.)

© Copyright IBM Corp. 2018, 2022 11-31


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Creating a final response – Step 4 (4 of 5)


• The action must end after
this step is reached.
• Change the “And then”
setting to End the action.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-25. Creating a final response – Step 4 (4 of 5)

Finally, make sure that the action ends after this step is reached. Change the “And then” setting to
End the action.

© Copyright IBM Corp. 2018, 2022 11-32


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Creating a final response – Step 4 (5 of 5)

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-26. Creating a final response – Step 4 (5 of 5)

Your steps now are completed and look like shown in the figure.
Click Try it to test a few scenarios.

© Copyright IBM Corp. 2018, 2022 11-33


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Try it out (1 of 2)

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-27. Try it out (1 of 2)

Try a few scenarios. Notice that when you state the type of bill up front, the assistant skips the
question about the type of bill and moves immediately to the next step.

© Copyright IBM Corp. 2018, 2022 11-34


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Get a real-life preview of your assistant: Preview

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-28. Get a real-life preview of your assistant: Preview

To see how your assistant would really work on one of your channels, open the preview page.
The preview page is a representation of your “draft” work in progress and has an inline preview for
you to test. You can also share your work with others on your team quickly with a sharable URL

© Copyright IBM Corp. 2018, 2022 11-35


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
11.3.Classic Watson Assistant

© Copyright IBM Corp. 2018, 2022 11-36


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Classic Watson
Assistant

Figure 11-29. Classic Watson Assistant

Classic Watson Assistant documentation


https://cloud.ibm.com/docs/assistant?topic=assistant-index

© Copyright IBM Corp. 2018, 2022 11-37


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

When to use classic Watson Assistant?


Reasons for using classic Watson Assistant include:
• The assistant was built before the new Watson Assistant became available in October 2021.
• Your developers are familiar and comfortable with the classic experience.
• You want greater control over the logic of the flow.
ƒ The dialog editor exposes more of the underlying artifacts (such as intents and entities) used to build
the AI models.
ƒ The dialog flow uses an if-then-else style structure that might be familiar to developers, but not to
content designers or customer-care experts.
• The following features are available in dialog-based conversations but not in Actions.
ƒ Contextual entities
ƒ Detection of other system entities
ƒ Image response type
ƒ Digression support
ƒ Webhook (log all messages) support
Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-30. When to use classic Watson Assistant?

Hint

Want to get started with actions, but need features that are available from a dialog? Use both.
Dialog is your primary conversation with users, but you can call an action from your dialog to
perform a discrete task. For more information see Calling actions from a dialog at
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-dialog-call-action

© Copyright IBM Corp. 2018, 2022 11-38


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
References:
Comparing actions and dialog
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-comparing-actions-dialo
g
Annotation-based method - Contextual entities
https://cloud.ibm.com/docs/assistant?topic=assistant-entities#entities-annotations-overview
Handling Watson Assistant response types
https://www.ibm.com/docs/en/voice-gateway?topic=states-handling-watson-assistant-respons
e-types
Response type image
https://www.ibm.com/docs/en/voice-gateway?topic=states-handling-watson-assistant-respons
e-types#wa_response_type_image
Understanding dialog skill digressions
https://cloud.ibm.com/docs/assistant?topic=assistant-tutorial-digressions
Webhook overview
https://cloud.ibm.com/docs/assistant?topic=assistant-webhook-overview

© Copyright IBM Corp. 2018, 2022 11-39


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Components
Classic Watson Assistant main components:
• Assistants
• Dialog skills
• Intents
• Entities
• Dialog

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-31. Components

The Watson Assistant main components are:


• Assistants
• Dialog skills
• Intents
• Entities
• Dialog

© Copyright IBM Corp. 2018, 2022 11-40


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Assistant
Assistant:
• A cognitive bot that you can customize for your business needs.
• A dialog is activated from the assistant settings.
• The assistant can be deployed through multiple interfaces, such as:
ƒ Messaging channels, like Slack and Facebook Messenger.
ƒ A simple chat widget on a website or on an existing company web page.
ƒ A custom application, such as a mobile app or a robot with a voice interface.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-32. Assistant

Assistants
An assistant is a cognitive bot that you can customize for your business needs and deploy across
multiple channels to help your customers where and when they need it.
You customize the assistant by adding to it the skills that it needs to satisfy your customers' goals.
Activate a dialog skill that can understand and address questions or requests with which your
customers typically need help. You provide information about the subjects or tasks that your
users ask about and how they ask about them. Then, the service dynamically builds a machine
learning model that is tailored to understand the same and similar user requests.
You can deploy the assistant through multiple interfaces, including:
• Existing messaging channels, such as Slack and Facebook Messenger.
• You can give your users access to the assistant through a simple chat widget that you publish
to a website or add to an existing company web page.
• You can design a custom application that incorporates it by making direct calls to the
underlying APIs.

© Copyright IBM Corp. 2018, 2022 11-41


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Dialog skill
Dialog skill:
• Acts as a container for all of the artifacts and training data.
• A skill contains the following types of artifacts:
ƒ Intents
ƒ Entities
ƒ Dialog
• A skill uses the training data to build a machine learning model to recognize similar user
inputs.
ƒ When you add or change the training data, the training process is triggered to ensure that the
underlying model stays up to date.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-33. Dialog skill

Skill
Sometimes referred to as dialog skill.
A Dialog skill acts as a container that contains the training data and logic that enables an assistant
to help your customers.
It contains the following types of artifacts:
• Intents
• Entities
• Dialog
As you add information, the data is used to build a machine learning model that can recognize
these and similar user inputs. Each time that you add or change the training data, the training
process is triggered to ensure that the underlying model stays up-to-date as your customer needs
and the topics they want to discuss change.

© Copyright IBM Corp. 2018, 2022 11-42


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Intent
Intent:
• Represents the purpose of or goal of a user's input.
• Tends to be general, such as a question about business location or a bill payment.
• For intent creation:
ƒ Plan the intents for application. Define an intent for each type of user request that you want your
application to support.
ƒ Teach Watson Assistant about your intents. Supply many examples of user input and indicate the
intents to which they map.
• In the tool, the name of an intent is always prefixed with ’#’. For example, #payment or
#inquiry.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-34. Intent

Intent
An intent represents the purpose of a user's input, such as a question about business locations or
a bill payment.
Plan the intents for an application: Consider what your customers might want to do and what
you want your application to be able to handle on their behalf. For example, you might want your
application to help your customers make a purchase. If so, you can add a #buy_something intent.
You define an intent for each type of user request that you want your application to support.
Teach Watson Assistant about your intents: After you decide the business requests that you
want your application to handle for your customers, you must teach Watson Assistant about them.
For each business goal (such as #buy_something), you must provide at least 10 examples of
utterances that your customers typically use to indicate their goal. For example, “I want to make a
purchase.”
Ideally, find real-world user utterance examples that you can extract from existing business
processes. The user examples should be tailored to your specific business. For example, if you are
an insurance company, your user examples might look more like this, “I want to buy a new XYZ
insurance plan.”
To train the dialog skill to recognize your intents, supply many examples of user input and indicate
to which intents they map. The examples that you provide are used by the service to build a
machine learning model that can recognize the same and similar types of utterances and map
them to the appropriate intent.
In the tool, the name of an intent is always prefixed with the # character.
Start with a few intents and test them as you iteratively expand the scope of the application.

© Copyright IBM Corp. 2018, 2022 11-43


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Intent (cont.)
Intent examples:
• “Good morning” -> #greeting.
• “Where can I find the nearest restaurant?” -> #location_info.
• “Where can I pay my electric bill?” -> #location_info.
• Remember: Intents represent what the user wants to achieve: a goal, an action, or verbs.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-35. Intent (cont.)

Intent examples:
• “Good morning” -> #greeting
• “Where can I find the nearest restaurant?” -> #location_info
• “Where can I pay my electric bill?” -> #location_info
Remember: Intents represent what the user wants to achieve: a goal, an action, or verbs.

© Copyright IBM Corp. 2018, 2022 11-44


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Entity
Entity
• Represents a term or object that is relevant to the user’s intent and that provides a specific
context for an intent.
• If intents represent verbs (the action a user wants to do), entities represent nouns (the object
of, or the context for that action).
• By recognizing the entities that are mentioned in the user's input, the service can reply with a
more targeted response or perform a required action.
• In the tool, the name of an entity is always prefixed with ’@’. For example, @street or
@contact_info.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-36. Entity

Entity
Entities represent information in the user input that is relevant to the user's purpose.
If intents represent verbs (the action a user wants to do), entities represent nouns (the object of,
or the context for, that action). For example, when the intent is to get a weather forecast, the
relevant location and date entities are required before the application can return an accurate
forecast.
Entities represent a class of object or a data type that is relevant to a user’s purpose. By
recognizing the entities that are mentioned in the user's input, the service can reply with a more
targeted response or perform a required action.

© Copyright IBM Corp. 2018, 2022 11-45


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Entity evaluation
• The Assistant service looks for terms in the user input by using exact matching of values,
synonyms, or patterns that are defined for the entities.
• Synonym entity:
ƒ Specify a bunch of synonyms, that is, words that have exact or similar meanings.
ƒ For example, for the entity value Blue, its synonyms can be Aqua, Navy, and Cyan.
• Pattern entity:
ƒ You specify a regular expression that defines the pattern for mentions.
ƒ For example, for email patterns such as name@ibm.com, the pattern can be:

\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-37. Entity evaluation

The Assistant service looks for terms in the user input that match the values, synonyms, or
patterns that you define for the entity:
• Synonym entity: Synonyms are words or phrases that mean exactly or nearly the same as the
corresponding entity. You define a category of terms as an entity (color), and then one or more
values in that category (blue). For each value, you specify several synonyms (aqua, navy, and
cyan). At run time, the service recognizes terms in the user input that exactly match the values
or synonyms that you defined for the entity as mentions of that entity.
• Pattern entity: You define a category of terms as an entity (contact_info), and then define one
or more values in that category (email). For each value, you specify a regular expression that
defines the textual pattern of mentions of that value type. For an email entity value, you might
want to specify a regular expression that defines a text@text.com pattern.
This email regex example can capture all mentions of emails in their proper format.
At run time, the service looks for patterns matching your regular expression in the user input,
and identifies any matches as mentions of that entity.

© Copyright IBM Corp. 2018, 2022 11-46


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Entity evaluation (cont.)


• System entity: A synonym entity that is prebuilt by IBM (such as numbers, dates, or others).

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-38. Entity evaluation (cont.)

System entity: A synonym entity that is prebuilt for you by IBM. They cover commonly used
categories, such as numbers, dates, and times. You simply enable a system entity to start using it.

© Copyright IBM Corp. 2018, 2022 11-47


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Dialog
Dialog
• A dialog is a branching conversation flow that defines how your application responds when it
recognizes the defined intents and entities.
• The dialog is made up of nodes that are chained together in a tree structure (graphically).
• Each node includes conditions for the node to be active, and also an output object that defines
the response that is provided.
• Think of the node as an if-then construction: If this condition is true, then return this response.

User

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-39. Dialog

Dialog
A dialog is a branching conversation flow that defines how your application responds when it
recognizes the defined intents and entities.
The dialog is made up of nodes that define steps in the conversation.
Dialog nodes are chained together in a tree structure (graphically).
Each node includes conditions for the node to be active, and also an output object that defines the
response that is provided.
Think of the node as an if-then construction: If this condition is true, then return this response.
Condition: Specifies the information that must be present in the user input for this node in the
dialog to be triggered.
Response: The utterance that the service uses to respond to the user.

© Copyright IBM Corp. 2018, 2022 11-48


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Dialog (cont.)
Dialog (cont.)
• A single node with one condition and response can handle simple user requests.
• To handle more complex tasks, you can add child nodes to ask the user for additional
information.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-40. Dialog (cont.)

Dialog
A single node with one condition and response can handle simple user requests.
To handle more complex tasks, you can add child nodes to ask the user for additional information.
A child node is processed after its parent node. NODE 1 is the parent node for CHILD NODE 1 and
CHILD NODE 2.
Some useful definitions:
• A root node is a node that does not depend on other nodes. In the example, NODE 1 is a root
node.
• A child node is a node that depends on another node, its parent node. The parent node is
processed first, and based on that processing, the child node is either processed or not.

© Copyright IBM Corp. 2018, 2022 11-49


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Conditions
Conditions
• Logical expressions that are evaluated to true or false.
• A node condition determines whether that node is used in the conversation.
• Conditions usually evaluate the intents and entities that are identified in the user responses,
but they can also evaluate information that is stored in the context.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-41. Conditions

Conditions
Conditions are logical expressions that are evaluated to true or false. A node condition determines
whether that node is used in the conversation or to choose among the possible responses to the
user.
Conditions usually evaluate the intents and entities that are identified in the user responses, but
they can also evaluate information that is stored in the context.

© Copyright IBM Corp. 2018, 2022 11-50


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Responses
Responses:
• The dialog response defines how to reply to the user.
• The dialog response consists of the messages that are based on the identified intents, entities,
or context that are communicated to the user when the dialog node is activated.
• You can add variations to the response for a more natural experience.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-42. Responses

Responses
Responses are messages that are based on the identified intents and entities that are
communicated to the user when the dialog node is activated. You can add variations of the
response for a more natural experience or add conditions to pick one response out of many in the
same dialog node.
The figure shows an example of adding different variations for greetings if the node is triggered by
a greeting intent from the user.

© Copyright IBM Corp. 2018, 2022 11-51


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Rich responses
Rich responses:
• In addition to the default response type of text, you can return other interactive response
types to enhance the user experience.
• The following response types are supported:
ƒ Image: Embeds an image into the response.
ƒ Option: Adds a list of one or more options.
ƒ Pause: Forces the application to wait for a specified number of milliseconds before continuing with
processing.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-43. Rich responses

Rich responses
In addition to the default response type of text, you can return responses with multimedia or
interactive elements, such as images or clickable buttons to simplify the interaction model of your
application and enhance the user experience.
The following response types are supported:
• Image: Embeds an image into the response.
• Option: Adds a list of one or more options. When a user clicks one of the options, an
associated user input value is sent to the service. How options are rendered can differ
depending on where you deploy the dialog. For example, in one integration channel, the
options might be displayed as clickable buttons, but in another they might be displayed as a
drop-down list.
• Pause: Forces the application to wait for a specified number of milliseconds before continuing
with processing. You can choose to show an indicator that the dialog is working on typing a
response. Use this response type if you need to perform an action that might take some time.

© Copyright IBM Corp. 2018, 2022 11-52


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Multiple (conditional) responses


Multiple (conditional) responses
• In a single dialog node, you can provide different responses, each one triggered by a different
condition. Use this approach to address multiple scenarios in a single node.
• Example: The service uses information that it collected earlier about the user's location to
tailor its response and provide information about the store nearest the user.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-44. Multiple (conditional) responses

In a single dialog node, you can provide different responses, each one triggered by a different
condition. Use this approach to address multiple scenarios in a single node.
In this example, the service uses information that it collected earlier about the user's location to
tailor its response and provide information about the store nearest the user. The conditional
responses are based on context values.
This single node now provides the equivalent function of four separate nodes.

© Copyright IBM Corp. 2018, 2022 11-53


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Watson Assistant dialog features (cont.)


Slots
• Add slots to a dialog node to gather multiple pieces of information from a user within that
node.
• Slots collect information at the user’s pace. Details that the user provides are saved, and the
service asks only for the details that the user did not provide.
• Example: User-provided values for multiple slots in one input.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-45. Watson Assistant dialog features (cont.)

Slots
Add slots to a dialog node to gather multiple pieces of information from a user within that node.
Slots collect information at the users' pace. Details that the user provides are saved, and the
service asks only for the details the use did not provide.
Example:
The user wants to reserve a table in a restaurant. The needed information is the number of guests,
the date, the time, and the name of the restaurant. When asked, the user might provide values for
multiple slots at once. For example, the input might include the information, ”There will be 6 of us
dining at 7 PM”. This one input contains two of the missing required values: the number of guests
and time of the reservation. The service recognizes and stores both of them, each one in its
corresponding slot. It then displays the prompt that is associated with the next empty slot, which
in this case asks the user, “Where would you like to eat?” to determine the restaurant slot and
stores the response. After the user replies, the service asks, “What day will this take place?” to
determine the date slot, stores it, and gives a reply.

© Copyright IBM Corp. 2018, 2022 11-54


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Dialog flow
Dialog flow
• The dialog standard flow is processed from top to bottom and left to right.
• Triggered by a successful condition.
• It ends when it reaches the last node in the branch that it is following.

User input

Match

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-46. Dialog flow

The dialog is processed by the service from top to bottom.


As it travels down the tree, if the service finds a condition that is met, it triggers that node. It then
moves from left to right on the triggered node to check the user input against any child node
conditions. As it checks the children nodes, it moves again from top to bottom.
The service continues to work its way through the dialog tree until it reaches the last node in the
branch that it is following.
If none of the conditions evaluates to true, then the response from the last node in the tree, which
typically has a special anything_else condition that always evaluates to true, is returned.
When you start to build the dialog, you must determine the branches to include and where to
place them. The order of the branches is important because nodes are evaluated from first to last.
The first node whose condition matches the input is used; any nodes that come later in the tree
are not triggered.

© Copyright IBM Corp. 2018, 2022 11-55


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Watson Assistant components (cont.)


• Dialog depiction

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-47. Watson Assistant components (cont.)

Dialog depiction
This diagram shows a mockup of a dialog tree that is built with the GUI dialog builder tool. It
contains two root dialog nodes. A typical dialog tree would likely have many more nodes, but this
depiction provides a glimpse of what a subset of nodes might look like.
The first root node has conditions for an intent value. It has two child nodes and each have a
condition on an entity value. The second child node defines two responses. The first response is
returned to the user if the value of the context variable matches the value that is specified in the
condition. Otherwise, the second response is returned.
This standard type of node is useful to capture questions about a certain topic and then in the root
response ask a follow-up question that is addressed by the child nodes. For example, it might
recognize a user question about discounts and ask a follow-up question about whether the user is
a member of any associations with which the company has special discount arrangements. The
child nodes provide different responses based on the user's answer to the question about
association membership.
The second root node is a node with slots. It also has conditions on an intent value. It defines a set
of slots, one for each piece of information that you want to collect from the user. Each slot asks a
question to elicit the answer from the user. It looks for a specific entity value in the user's reply to
the prompt, which it then saves in a slot context variable.
This type of node is useful for collecting details that you might need to perform a transaction on
the user's behalf. For example, if the user's intent is to book a flight, the slots can collect the origin
and destination location information, travel dates, and so on.

© Copyright IBM Corp. 2018, 2022 11-56


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Switching the experience


• You can switch back and forth between the new
experience and the classic experience.
• To switch between the new and classic experiences,
following these steps:
1. From the Watson Assistant interface, click the
Manage icon to open your account menu.
2. Select Switch to classic experience or Switch to
new experience from the account menu.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-48. Switching the experience

You can easily switch back and forth between the new experience and the classic experience.
However, the new experience provides a simplified user interface, an improved deployment
process, and access to the latest features.
To switch between the new and classic experiences, following these steps:
1. From the Watson Assistant interface, click the Manage icon to open your account menu.
2. Select Switch to classic experience or Switch to new experience from the account menu.
You don’t lose any work if you switch to a different experience, and other users of the same
instance are not affected. However, keep in mind that any work you do in one experience is not
available in the other experience. You can switch back and forth at any time.
References:
Switching the experience
https://cloud.ibm.com/docs/watson-assistant#welcome-new-assistant-switch-experience
Switching between new and classic experiences
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-switch-experience

© Copyright IBM Corp. 2018, 2022 11-57


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
11.4.Migrating to the new experience

© Copyright IBM Corp. 2018, 2022 11-58


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Migrating to the new


experience

Figure 11-49. Migrating to the new experience

© Copyright IBM Corp. 2018, 2022 11-59


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Deciding which experience to use


• If you are using a Watson Assistance instance that you created before October 2021 , you
might still be using the classic Watson Assistant experience.
• Consider the following questions to decide which experience you want to use:
ƒ Do you want to build a new actions-based assistant?
í The new experience provides a simplified user interface that was designed around actions, and an
improved deployment process
ƒ Are you working on an existing assistant built in the classic Watson Assistant?
í If you have a dialog-based assistant, consider migrating it to the new experience so you can take
advantage of the new process for publishing and deploying your assistant.
ƒ Do you want to convert an existing dialog-based assistant to use actions?
í If you have a dialog-based assistant, but you want to reimplement it to use actions instead, start by
migrating it to the new experience. You can then start to use actions alongside your dialog, and you
can replace your dialog nodes with actions at your own pace.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-50. Deciding which experience to use

If you are using a Watson Assistance instance that you created before October 2021, you might
still be using the classic Watson Assistant experience. To take advantage of the latest features,
consider switching to the new experience.
Consider the following questions to decide which experience you want to use:
• Do you want to build a new actions-based assistant?
The new experience provides a simplified user interface that was designed around actions,
and an improved deployment process. If you plan to build an actions-based assistant, use the
new experience for access to the latest features and improvements.
• Are you working on an existing assistant built in the classic Watson Assistant?
If you have a dialog-based assistant that was built by using the classic Watson Assistant, and
you are not currently planning to migrate to an actions-based assistant, you might still want to
consider migrating it to the new experience so you can take advantage of the new process for
publishing and deploying your assistant. Migrating to the new experience also makes it easy
for you to begin using actions when you are ready.
For more information about how to migrate a dialog-based assistant to the new experience,
see Activating dialog and migrating skills at
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-activate-dialog
• Do you want to convert an existing dialog-based assistant to use actions?
If you have a dialog-based assistant, but you want to reimplement it to use actions instead,
start by migrating it to the new experience. You can then start to use actions alongside your
dialog, and you can replace your dialog nodes with actions at your own pace.
For more information about using a dialog with actions, see Calling actions from a dialog at
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-dialog-call-action

© Copyright IBM Corp. 2018, 2022 11-60


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
References:
Migrating to the new experience
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-migrate-overview
New Watson Assistant - Deployment process overview
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-publish-overview
Activating dialog and migrating skills
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-activate-dialog
Calling actions from a dialog
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-dialog-call-action

© Copyright IBM Corp. 2018, 2022 11-61


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Migrating intents and entities


• You can migrate your intents and entities from the classic Watson Assistant experience to the
new Watson Assistant experience.
• In the new experience, intents are known as example phrases in an action
• In the new experience, entities are known as saved customer responses.
• Downloading intents
ƒ You can download an intent to a CSV file, so you can then upload and reuse the examples as example
phrases in the new Watson Assistant experience.
• Downloading entities
ƒ You can download entities to a CSV file, so you can then upload and reuse them as saved customer
responses in the new Watson Assistant experience.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-51. Migrating intents and entities

Downloading intents
You can download an intent to a CSV file, so you can then upload and reuse the examples as
example phrases in the new Watson Assistant experience.
1. Go to the Intents page.
2. Select the intent that you want to download, and then click the Download icon .
3. Specify the name and location in which to store the CSV file that is generated, and then
click Save.
4. Upload the examples from the intent as example phrases for a specific action in the new
Watson Assistant.
For more information, see Uploading phrases
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-understand-questions#u
nderstand-questions-uploading-examples

© Copyright IBM Corp. 2018, 2022 11-62


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
Downloading entities
You can download a number of entities to a CSV file, so you can then upload and reuse them as
saved customer responses in the new Watson Assistant experience.
1. Go to the Entities page.
2. Select the entities that you want to download, and then click the Download icon .
3. Specify the name and location in which to store the CSV file that is generated, and then
click Save.
4. Upload the entities as saved customer responses in the new Watson Assistant. For more
information, see Uploading saved customer responses at
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-collect-info#uploadin
g-saved-customer-response
References:
Migrating intents and entities
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-migrate-intents-entities
Uploading phrases
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-understand-questions#u
nderstand-questions-uploading-examples
Uploading saved customer responses
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-collect-info#uploading-s
aved-customer-response

© Copyright IBM Corp. 2018, 2022 11-63


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Activating dialog
• To use an existing dialog skill, activate
the dialog feature in your assistant.
• To activate the dialog feature in the
new experience:
1. Create or open an assistant where you
want to use a dialog as the primary
conversation with users.
2. Open Assistant settings.
3. Click Activate dialog.
4. In the confirmation that displays,
click Activate dialog again.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-52. Activating dialog

To use an existing dialog skill, activate the dialog feature in your assistant. Then, you can upload
your existing skill.
Activating dialog
To activate the dialog feature in the new experience:
1. Create or open an assistant where you want to use a dialog as the primary conversation with
users.
2. Open Assistant settings.
3. Click Activate dialog.
4. In the confirmation that displays, click Activate dialog again.
References:
Activating dialog and migrating skills
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-activate-dialog
Downloading a skill
https://cloud.ibm.com/docs/assistant?topic=assistant-skill-tasks#skill-tasks-download

© Copyright IBM Corp. 2018, 2022 11-64


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Migrating skills
• Once the dialog feature is activated, you can start a new
dialog conversation from scratch. Or if you have an existing
dialog skill, you can migrate it to the new Watson Assistant.
• To migrate an existing dialog skill:
1. Use the classic experience to download your dialog skill in
JSON format.
2. In the new Watson Assistant, open the Dialog page.
3. In Options, choose Upload / Download.
4. On the Upload tab, upload the JSON file for your dialog skill.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-53. Migrating skills

Migrating existing skills


Once the dialog feature is activated, you can start a new dialog conversation from scratch. Or if
you have an existing dialog skill, you can migrate it to the new Watson Assistant.
To migrate an existing dialog skill:
1. Use the classic experience to download your dialog skill in JSON format.
2. In the new Watson Assistant, open the Dialog page.
3. In Options, choose Upload / Download.
4. On the Upload tab, upload the JSON file for your dialog skill.
References:
Downloading a skill
https://cloud.ibm.com/docs/assistant?topic=assistant-skill-tasks#skill-tasks-download
Migrating existing skills
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-activate-dialog#activate-
dialog-upload

© Copyright IBM Corp. 2018, 2022 11-65


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Calling actions from a dialog


• In the new Watson Assistant, you can use actions with your primary dialog conversation.
ƒ A dialog takes precedence over actions.
• You can use actions to supplement a dialog-based conversation, but the dialog drives the
conversation with users to match their requests.
• A dialog node calls an action to perform a task and then return to the dialog. From a single
dialog node, you can make a call to either a webhook or an action, not both.
• Choose the approach that best suits your needs:
ƒ Call an action if you want to perform a discrete and self-contained task, and then return to the dialog to
be ready to address any new user requests.
í Data that is collected from the user during action processing must be stored as a session variable for
it to be passed to the dialog.
ƒ Call a webhook if you want to send a request to a web service to complete a task and return a response
that can be used later by this dialog.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-54. Calling actions from a dialog

In the new Watson Assistant, you can use actions with your primary dialog conversation. A dialog
feature takes precedence over actions. You can use actions to supplement a dialog-based
conversation, but the dialog drives the conversation with users to match their requests.
A dialog node calls an action to perform a task and then return to the dialog. From a single dialog
node, you can make a call to either a webhook or an action, not both. Choose the approach that
best suits your needs:
• Call an action if you want to perform a discrete and self-contained task, and then return to the
dialog to be ready to address any new user requests. Data that is collected from the user
during action processing must be stored as a session variable for it to be passed to the dialog.
• Call a webhook if you want to send a request to a web service to complete a task and return a
response that can be used later by this dialog. For more information, see Extending your
assistant with webhooks.

Note

For step-by-step instructions, see “Adding a call to an action” at


https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-dialog-call-action#dialog
-call-action-add

© Copyright IBM Corp. 2018, 2022 11-66


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
References:
Calling actions from a dialog
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-dialog-call-action
Extending your assistant with webhooks
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-webhook-overview
Adding a call to an action
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-dialog-call-action#dialog
-call-action-add

© Copyright IBM Corp. 2018, 2022 11-67


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

When to call an action from a dialog


You might want to call an action from a dialog in the following scenarios:
• You want to perform an action from multiple dialog threads.
ƒ For example, you want to ask customers how satisfied they are with your service. You can define a
single action to check customer satisfaction and call it from multiple branch-ending dialog nodes.
• You want to see how actions works.
ƒ In this scenario, you can pick an intent for the action to handle. If you plan for the action to be called
from the dialog only, you can define the user examples for the intent that triggers the dialog node.

ň Note ņņņņņņņņņņņņņņņņņ
For step-by-step instructions, see “Adding a call to an action” at https://cloud.ibm.com/docs/watson-
assistant?topic=watson-assistant-dialog-call-action#dialog-call-action-add
Ŋņņņņņņņņņņņņņņņņņņņņ

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-55. When to call an action from a dialog

You might want to call an action from a dialog in the following scenarios:
• You want to perform an action from multiple dialog threads.
For example, you want to ask customers how satisfied they are with your service. You can
define a single action to check customer satisfaction and call it from multiple branch-ending
dialog nodes.
In this scenario, you don't need to define an intent, such as #check_satisfaction. The action is
called automatically, replacing a jump to another dialog node's response.
• You want to see how actions works.
In this scenario, you can pick an intent for the action to handle. If you plan for the action to be
called from the dialog only, you can define the user examples for the intent that triggers the
dialog node. When you define the action, you can add one customer example only, reducing
the time that you need to spend building the action.

Note

For step-by-step instructions, see “Adding a call to an action” at


https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-dialog-call-action#dialog
-call-action-add

© Copyright IBM Corp. 2018, 2022 11-68


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
References:
Calling actions from a dialog
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-dialog-call-action
Extending your assistant with webhooks
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-webhook-overview
Adding a call to an action
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-dialog-call-action#dialog
-call-action-add

© Copyright IBM Corp. 2018, 2022 11-69


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
11.5.Enriching the chatbot

© Copyright IBM Corp. 2018, 2022 11-70


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Enriching the
chatbot

Figure 11-56. Enriching the chatbot

© Copyright IBM Corp. 2018, 2022 11-71


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Persona
• Creating a persona for your bot makes the bot friendlier and engages its users.
• You can create a bot persona by adding some distinguishing characteristics to your chatbot.
• Avatar: A face for your chatbot. A simple 2D graphic image, or even a 3D figure adds a nice
touch, along with a name.
ƒ Adding a gender is not always a good idea. Generally, the chatbot should be gender-neutral, such as a
friendly android (robot) or a friendly pet like a cat or a bird.
• A voice: Makes a chatbot more interactive and adds value to its personality.
ƒ Easy to implement because of the many available text to speech services.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-57. Persona

Although it might be clear to the user that they are talking to a chatbot, creating a persona makes
the bot friendlier and engages its users. You can create a bot persona by providing some
distinguishing characteristics to your chatbot. For example, adding the following features can help
to accomplish this goal:
• Avatar
An avatar adds a face to your chatbot. A simple 2D graphic image adds a nice touch, along with
a name. Adding a gender is not always a good idea. Generally, the chatbot should be
gender-neutral, such as a friendly android (robot) or a friendly pet like a cat or a bird.
• A voice
Adding a voice to your chatbot makes it more interactive and adds value to its personality.
Doing so requires almost no effort because most text to speech services can be added to your
existing output response text to transform it into audio.

© Copyright IBM Corp. 2018, 2022 11-72


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Emotion and tone


• Sentiment analysis can map user emotion input to a positive, negative, or neutral status.
ƒ Your chatbot can then sense the user’s positive comment and react to it, or sense a negative input and
direct the conversation appropriately.
• Tone analysis can perform more advanced interpretation of the user’s mood.
ƒ For example, it can detect whether the user is frustrated or thankful. The chatbot can then reply with a
customized answer to each mood, giving your bot emotional AI that adds to its personality and makes
it friendlier.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-58. Emotion and tone

• Sentiment analysis can map user emotion input to a positive, negative, or neutral status. It
adds emotion to your chatbot. Your chatbot can sense the user’s positive comment and react
to it, or sense a negative input and direct the conversation appropriately.
• Tone analysis can perform more advanced interpretation of the user’s mood. For example, it
can detect whether the user is frustrated or thankful. The chatbot can then reply with a
customized answer to each mood, giving your bot emotional AI that adds to its personality and
makes it friendlier.

© Copyright IBM Corp. 2018, 2022 11-73


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Integrations page
• The page is organized into three
sections:
ƒ Essential channels. The
foundations of any assistant’s
ability to reach users. They are
web chat and phone.
ƒ Extensions. Customize your
assistant by adding Search
capabilities and connecting to
third-party APIs with the Build
custom extensions option.
ƒ Channels. Deploy your assistant to
Slack, Facebook Messenger and
SMS/WhatsApp with Twilio.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-59. Integrations page

For your assistant to reach its potential as a comprehensive user solution, it needs to seamlessly
call out to and pull information from a wide variety of web apps.
Managing all the possible channels, integrations, and extensions might seem daunting task, but
Watson Assistant simplifies the process with its Integrations page. The “Integrations” page
consolidates all of your channels, extensions, and third-party connections in one spot,
streamlining your ability to manage how and where users interact with your assistant.
To open the Integrations page, click the Integrations icon in the Watson Assistant home page.
The page is organized into three sections:
• Essential channels. The foundations of any assistant’s ability to reach users. They are web
chat and phone.
• Extensions. Customize your assistant by adding Search capabilities and connecting to
third-party APIs with the Build custom extensions option.
• Channels. Deploy your assistant to Slack, Facebook Messenger and SMS/WhatsApp with
Twilio.
References:
Watson Assistant Integrations: channel your knowledge
https://medium.com/ibm-watson/watson-assistant-integrations-channel-your-knowledge-909d
fecae26
Adding integrations
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-deploy-integration-add

© Copyright IBM Corp. 2018, 2022 11-74


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Integrations: Essential channels


• The most common methods of deploying assistants.
ƒ Web chat is a code snippet that you can immediately embed in your company’s website.
ƒ Phone integration makes your assistant available to customers over the phone.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-60. Integrations: Essential channels

Essential channels constitute the foundations of any assistant’s ability to reach users. They are
web chat and phone. They are the most common methods of deploying assistants.
• Web chat is a code snippet that you can immediately embed in your website.
When you build a custom user interface for your assistant, you spend a lot of time and effort
writing code to solve typical UI problems. For example, you must keep up with browser
support changes, manage scrolling behavior, validate input, and design the layout and styling.
The time that you spend designing and maintaining the UI can be better spent building a
quality assistant instead. When you use the web chat integration, Watson Assistant manages
the user interface, so you can focus on designing conversational exchanges that address the
unique business needs of your customers.
• Phone integration. By adding the phone integration to your assistant, you can make your
assistant available to customers over the phone. When you add the phone integration to your
assistant, you can automatically generate a working phone number that is automatically
connected to your assistant. Or, if you prefer, you can connect the assistant to your existing
infrastructure by configuring an existing Session Initiation Protocol (SIP) trunk.
When your customer makes a phone call by using the telephone number connected to your
assistant, the phone integration answers. The integration converts output from your assistant
into voice audio by using the IBM Watson Text to Speech service. The audio is sent to the
telephone network through the SIP trunk. When the customer replies, the voice input is
converted into text by using the IBM Watson Speech to Text service.

© Copyright IBM Corp. 2018, 2022 11-75


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Note

Phone integration is available only to Plus or Enterprise plan users.

References:
Web chat overview
https://cloud.ibm.com/docs/assistant?topic=assistant-web-chat-basics
Integrating the web chat with your website
https://cloud.ibm.com/docs/assistant?topic=assistant-deploy-web-chat
Integrating with phone
https://cloud.ibm.com/docs/assistant?topic=assistant-deploy-phone

© Copyright IBM Corp. 2018, 2022 11-76


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Integrations: Extensions
• Add features or content to your assistant custom or pre-built extensions.
ƒ Requires an OpenAPI document (formerly known as Swagger), which is an open standard for
describing and documenting REST APIs.
• Search integration gives your assistant access to corporate data collections that it can mine for
answers (Plus plan).

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-61. Integrations: Extensions

If you need to integrate your assistant with an external service that has a REST API, you can build
a custom extension by importing an OpenAPI document (previously known as Swagger).
After you create a custom extension, you can connect it to an assistant as an integration. In your
actions, you can then define steps that interact with the external service by calling the extension.
For more information about connecting a custom extension to an assistant, see Add a custom
extension at
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-add-custom-extension.

You can put your subject matter expertise to work by adding search. The search integration gives
your assistant access to corporate data collections that it can mine for answers.
When a search integration is added, your assistant can route complex customer inquiries to the
IBM Watson Discovery service. Discovery treats the user input as a search query. It finds
information that is relevant to the query from an external data source and returns it to the
assistant. With search integration, the assistant can query existing company documents or data to
see whether any useful information can be found and shared with the customer.

Note

Search integration is available only to Plus or Enterprise plan users.

© Copyright IBM Corp. 2018, 2022 11-77


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
References:
Add a custom extension
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-add-custom-extension
OpenAPI Specification
https://swagger.io/specification/
Watson Assistant Extensions Starter Kit
https://github.com/watson-developer-cloud/assistant-toolkit/tree/master/integrations/extensio
ns
Adding a search integration
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-search-add

© Copyright IBM Corp. 2018, 2022 11-78


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Integrations: Channels
• Deploy your assistant to third-party channels to expand your reach.
• Messaging with you assistant through messaging apps:
ƒ Facebook Messenger
ƒ Slack
ƒ SMS with Twilio
ƒ WhatsApp with Twilio

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-62. Integrations: Channels

The final section of the “Integrations” page contains quick links to configure your assistant for
deployment to four of the most widely used digital messaging apps:
• Facebook Messenger
• Slack
• SMS with Twilio
• WhatsApp with Twilio
By using an existing account with these services, you can make your assistant available through
these apps in a matter of minutes.
References:
Adding integrations
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-deploy-integration-add
Watson Assistant Integrations: channel your knowledge
https://medium.com/ibm-watson/watson-assistant-integrations-channel-your-knowledge-909d
fecae26

© Copyright IBM Corp. 2018, 2022 11-79


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Speech recognition
• You can use IBM, Google, and Microsoft speech to text services to enable your chatbot to
understand user speech.
• This feature is heavily used in home automation chatbots and automation tasks in general.
ƒ For example, in Microsoft Windows you can give commands to Cortana by using your voice without
touching a key or pressing a mouse button. You can do the same with Siri on the Apple iPhone.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-63. Speech recognition

With advancements in speech to text technology, you can use IBM, Google, and Microsoft speech
to text services to enable your chatbot to understand user speech.
This feature is heavily used in home automation chatbots and automation tasks in general. For
example, in Microsoft Windows you can give commands to Cortana by using your voice without
touching a key or pressing a mouse button. You can do the same with Siri on the Apple iPhone.

© Copyright IBM Corp. 2018, 2022 11-80


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Unit summary • Describe the experiences available in Watson Assistant to build


chatbots.
• Describe the main components of new Watson Assistant.
• Explain how to build a chatbot with Actions and Steps.
• Describe the main components of classic Watson Assistant.
• Describe how to build a chatbot with Intent, Entities, and Dialog
Skills.
• Compare action-based conversations and dialog-based
conversations.
• Describe when and how to migrate from classic to new Watson
Assistant.
• Test a chatbot.
• Explain how to enrich a chatbot.

© Copyright IBM Corporation 2018, 2022

Figure 11-64. Unit summary

© Copyright IBM Corp. 2018, 2022 11-81


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Review questions
1. True or False: In Watson Assistant, Skill can contain one or more entities.
2. True or False: In Watson Assistant, @type is an example of an intent.
3. True or False: The dialog flow is from top to bottom and left to right.
4. Which of the following response types can be used in a dialog node?
a. Image
b. Text
c. Option
d. All the above

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-65. Review questions

© Copyright IBM Corp. 2018, 2022 11-82


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Review questions (cont.)


5. #pay_bill is an example of ____
a. Intent
b. Entity
c. Skills
d. Workspace

6. A branching conversation flow that defines how your chatbot responds when it recognizes the
input from the user.
a. Intent
b. Dialog
c. Condition
d. Entity

7. True or False: @menu is an example of intent.


Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-66. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 11-83


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Review questions (cont.)


8. True or False: Actions can be called from a Dialog.
9. Which if the following are examples of actions (select all that apply)?
a. Pay bill
b. Menu
c. Balance in bank account
d. Withdraw money
e. Account number
f. a and b.
g. a, c, d.
h. b and e

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-67. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 11-84


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Review questions (cont.)


10.It is used to insert the context that you gathered from the customer.
a. Action variable
b. Condition
c. Entity
d. Intent
e. Webhook

11.True or False: The new Watson Assistant experience is built around Dialog.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-68. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 11-85


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Review answers
1. True or False: In Watson Assistant, Skill can contain one or more entities.
2. True or False: In Watson Assistant, @type is an example of an intent.
3. True or False: The dialog flow is from top to bottom and left to right.
4. Which of the following response types can be used in a dialog node?
a. Image
b. Text
c. Option
d. All the above

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-69. Review answers

© Copyright IBM Corp. 2018, 2022 11-86


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Review answers (cont.)


5. #pay_bill is an example of ____
a. Intent
b. Entity
c. Skills
d. Workspace

6. A branching conversation flow that defines how your chatbot responds when it recognizes the
input from the user.
a. Intent
b. Dialog
c. Condition
d. Entity

7. True or False: @menu is an example of intent.


Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-70. Review answers (cont.)

© Copyright IBM Corp. 2018, 2022 11-87


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Review answers (cont.)


8. True or False: Actions can be called from a Dialog.
9. Which if the following are examples of actions (select all that apply)?
a. Pay bill
b. Menu
c. Balance in bank account
d. Withdraw money
e. Account number
f. a and b.
g. a, c, d
h. b and e

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-71. Review answers (cont.)

© Copyright IBM Corp. 2018, 2022 11-88


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Review answers (cont.)


10.It is used to insert the context that you gathered from the customer.
a. Action variable
b. Condition
c. Entity
d. Intent
e. Webhook

11.True or False: The new Watson Assistant experience is built around Dialog.

Introduction to IBM Watson Assistant © Copyright IBM Corporation 2018, 2022

Figure 11-72. Review answers (cont.)

© Copyright IBM Corp. 2018, 2022 11-89


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Exercise: Getting started with Watson Assistant

Figure 11-73. Exercise: Getting started with Watson Assistant

© Copyright IBM Corp. 2018, 2022 11-90


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Exercise • This exercise introduces IBM Watson Assistant and walks you
through the process of creating a very simple chatbot with Watson
objectives Assistant.
• After completing this exercise, you should be able to:
ƒ Create a Watson Assistant service instance.
ƒ Create a Watson Assistant dialog skill.
ƒ Add intents.
ƒ Build a dialog.

© Copyright IBM Corporation 2018, 2022

Figure 11-74. Exercise objectives

After completing this exercise you should be able to:


• Create a Watson Assistant service instance.
• Create a Watson Assistant dialog skill.
• Add intents.
• Build a dialog.

© Copyright IBM Corp. 2018, 2022 11-91


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Exercise: Help Desk Chatbot

Figure 11-75. Exercise: Help Desk Chatbot

© Copyright IBM Corp. 2018, 2022 11-92


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Exercise • This exercise describes how to create a chatbot and publish it


quickly without coding by using the IBM Watson Assistant service.
objectives For this example, you create a Help Desk chatbot. However, you can
customize the chatbot to take any other role, such as delivery
service, Q&A, student assistant, and more.
• After completing this exercise, you should be able to:
ƒ Add intents and entities that are imported from previous assistant.
ƒ Build a dialog.
ƒ Create an assistant and add dialog skills to it.
ƒ Publish a chatbot to a webpage.

© Copyright IBM Corporation 2018, 2022

Figure 11-76. Exercise objectives

© Copyright IBM Corp. 2018, 2022 11-93


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty
Exercise: Exploring the new Watson Assistant: Creating a
retail customer service chatbot

Figure 11-77. Exercise: Exploring the new Watson Assistant: Creating a retail customer service chatbot

© Copyright IBM Corp. 2018, 2022 11-94


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 11. Introduction to IBM Watson Assistant

Uempty

Exercise • This exercise introduces the new Watson Assistant capabilities and
walks you through the process of creating actions with steps,
objectives conditions, and variables for a retail customer service chatbot.
• After completing this exercise you should be able to:
• Create a Watson Assistant service instance.
• Create actions.
• Create actions with conditions.
• Create actions with variables.

© Copyright IBM Corporation 2018, 2022

Figure 11-78. Exercise objectives

© Copyright IBM Corp. 2018, 2022 11-95


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Unit 12.Introduction to computer vision


Estimated time
00:30

Overview
This unit provides a high-level introduction to computer vision (CV).

© Copyright IBM Corp. 2018, 2022 12-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Unit objectives • Define computer vision (CV).


• Describe how CV works.
• Recount the history of CV and its advancement with artificial
intelligence (AI).
• Identify CV applications, tasks, and use cases.
• List tools and services for CV.

© Copyright IBM Corporation 2018, 2022

Figure 12-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 12-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

What is computer vision


• Computer vision is a branch of science that is concerned with processing images to extract,
analyze, and understand useful information from a single image or image sequence.
• It aims at simulating the human visual system.
• It uses various machine learning and deep learning algorithms to analyze images for scenes,
objects, faces, and other content in videos, photos, and pictures in general.

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-2. What is computer vision

Computer vision is a branch of science that is concerned with processing images to extract,
analyze, and understand useful information from a single image or image sequence. It aims to
create an artificial (computer) system that can achieve the capabilities of a human visual system
so that the machine can “see”.
CV uses various machine learning algorithms to analyze images for scenes, objects, faces, and
other content in videos, photos, and pictures in general.
References:
The British Machine Vision Association
https://britishmachinevisionassociation.github.io/
What is computer vision?
https://www.ibm.com/topics/computer-vision?mhsrc=ibmsearch_a&mhq=computer%20vision
%20history

© Copyright IBM Corp. 2018, 2022 12-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

How does computer vision work


• Two essential technologies are used in computer vision: deep learning and a convolutional
neural network (CNN).
• Deep learning is a subset of machine learning where neural network — algorithms inspired by
the human brain — learn from large amounts of data.
• A CNN helps a deep learning model by breaking down images into pixels that are given tags or
labels. It uses the labels to perform convolutions (a mathematical operation on two functions
to produce a third function) and makes predictions about what it is “seeing.”
• Deep learning is similar to a traditional neural network, but it has many more hidden layers.
ƒ The more complex the problem, the more hidden layers are in the model.
• Deep learning algorithms perform a task repeatedly and gradually improve the outcome
through deep layers that enable progressive learning.

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-3. How does computer vision work

Computer vision needs lots of data. It runs analyses of data over and over until it discerns
distinctions and ultimately recognize images. For example, to train a computer to recognize
automobile tires, it needs to be fed vast quantities of tire images and tire-related items to learn
the differences and recognize a tire, especially one with no defects.
Two essential technologies are used to accomplish this goal: a type of machine learning
called deep learning and a convolutional neural network (CNN).
Machine learning uses algorithmic models that enable a computer to teach itself about the
context of visual data. If enough data is fed through the model, the computer will “look” at the
data and teach itself to tell one image from another. Algorithms enable the machine to learn by
itself, rather than someone programming it to recognize an image.
A CNN helps a machine learning or deep learning model “look” by breaking down images into
pixels that are given tags or labels. It uses the labels to perform convolutions (a mathematical
operation on two functions to produce a third function) and makes predictions about what it is
“seeing.” The neural network runs convolutions and checks the accuracy of its predictions in a
series of iterations until the predictions start to come true. It is then recognizing or seeing images
in a way similar to humans.
Much like a human making out an image at a distance, a CNN first discerns hard edges and simple
shapes, then fills in information as it runs iterations of its predictions. A CNN is used to understand
single images. A recurrent neural network (RNN) is used in a similar way for video applications to
help computers understand how pictures in a series of frames are related to one another.

© Copyright IBM Corp. 2018, 2022 12-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty
References:
What is computer vision?
https://www.ibm.com/topics/computer-vision?mhsrc=ibmsearch_a&mhq=computer%20vision
%20history
Deep learning
https://www.ibm.com/cloud/watson-studio/deep-learning
What is deep learning?
https://www.ibm.com/cloud/learn/deep-learning?mhsrc=ibmsearch_a&mhq=deep%20learning
#toc-what-is-de-6i8FHi1_
What are convolutional neural networks?
https://www.ibm.com/cloud/learn/convolutional-neural-networks#toc-what-are-c-MWGVhUiG

© Copyright IBM Corp. 2018, 2022 12-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

How does computer vision work (cont.)


• A recurrent neural network (RNN) is a type of artificial neural network which uses sequential
data or time series data.
• RNN are typically used in natural language and speech recognition applications as it leverages
sequential or times series data.
• While a CNN is used to understand single images. A recurrent neural network (RNN) is used in
a similar way for video applications to help computers understand how pictures in a series of
frames are related to one another.

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-4. How does computer vision work (cont.)

Different types of neural networks address specific problems or data sets. For example,
Convolutional neural networks (CNNs), are used primarily in computer vision and image
classification applications. CNNs can detect features and patterns within an image, enabling
tasks, like object detection or recognition. In 2015, a CNN bested a human in an object
recognition challenge for the first time.
Recurrent neural network (RNNs) are typically used in natural language and speech recognition
applications as they leverage sequential or times series data.
Much like a human making out an image at a distance, a CNN first discerns hard edges and simple
shapes, then fills in information as it runs iterations of its predictions. A CNN is used to understand
single images. A recurrent neural network (RNN) is used in a similar way for video applications to
help computers understand how pictures in a series of frames are related to one another.

© Copyright IBM Corp. 2018, 2022 12-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty
References:
What is computer vision?
https://www.ibm.com/topics/computer-vision?mhsrc=ibmsearch_a&mhq=computer%20vision
%20history
Deep Learning
https://www.ibm.com/cloud/learn/deep-learning?mhsrc=ibmsearch_a&mhq=deep%20learning
#toc-what-is-de-6i8FHi1_
Recurrent Neural Networks (RNNs)
https://www.ibm.com/cloud/learn/recurrent-neural-networks
Convolutional neural networks (CNNs),
https://www.ibm.com/cloud/learn/convolutional-neural-networks

© Copyright IBM Corp. 2018, 2022 12-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Computer vision history


ƒ 1959: Image processing starts with simple shapes like straight edges when neurophysiologists
showed a cat an array of images, attempting to correlate a response in its brain.
ƒ 1963: Computers were able to transform two-dimensional images into three-dimensional forms.
ƒ 1974: The introduction of optical character recognition (OCR) technology, which could recognize text
that is printed in any font or typeface. Similarly, intelligent character recognition (ICR) could decipher
hand-written text by using neural networks.
ƒ 1982: Algorithms are introduced for machines to detect edges, corners, curves, and similar basic
shapes. Concurrently, convolutional layers in a neural network are introduced.
ƒ 2000: The focus of study was on object recognition.
ƒ 2001: The first real-time face recognition applications appeared.
ƒ 2010: The ImageNet data set became available. It contained millions of tagged images across a
thousand object classes and provides a foundation for the CNNs and deep learning models that are
used today.
ƒ 2012: CNN is entered into an image recognition contest. The AlexNet model significantly reduced the
error rate for image recognition.

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-5. Computer vision history

The slide shows a brief timeline that depicts the most important milestones in computer vision
research and development.
Reference:
The history of computer vision
https://www.ibm.com/topics/computer-vision?mhsrc=ibmsearch_a&mhq=computer%20vision
%20history

© Copyright IBM Corp. 2018, 2022 12-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Computer vision applications


• Manufacturing: Ensure that products are being positioned correctly on an assembly line.
• Visual auditing: Look for visual compliance or deterioration in a fleet of trucks, planes,
windmills, transmission or power towers , and so on.
• Insurance: Classify claims images into different categories.
• Medical image processing: Detect tumors.
• Automotive industry: Object detection for safety.

Identifying skin cancer by


using CV

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-6. Computer vision applications

CV can be used in many applications and industries:


• Manufacturing: Use images from a manufacturing setting to make sure that products are
being positioned correctly on an assembly line, or ensure product quality by identifying
defective parts on the production line instead of by using manual validation.
• Visual auditing: Look for visual compliance or deterioration in a fleet of trucks, planes, or
windmills, etc.. in the field. Train custom models to understand what defects look like.
• Insurance: Rapidly process claims by using images to classify claims into different categories.
• Social listening: Use images from your product line or your logos to track buzz about your
company on social media.
• Medical image processing: Using images for diagnosing patients, such as the detection of
tumors.
• Automotive industry: There are many applications for CV in cars. For example, while parking
a car, a camera can detect objects and warn the driver when they get too close to them.
Reference:
Computer vision
https://www.research.ibm.com/artificial-intelligence/computer-vision/

© Copyright IBM Corp. 2018, 2022 12-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Computer vision applications (cont.)


• Social commerce: Use an image of a house to find similar homes that are for sale.
• Social listening: Track the buzz about your company on social media by looking for product
logos.
• Retail: Use the photo of an item to find its price at different stores.
• Education: Use pictures to find educational material on similar subjects.
• Public safety: Automated license-plate reading.

Company’s logo search

Introduction to computer vision


Interactive image search © Copyright IBM Corporation 2018, 2022

Figure 12-7. Computer vision applications (cont.)

Social commerce: Use an image of a house to find similar homes that are for sale.
Social listening: Use images from your product line or your logos to track buzz about your
company on social media.
Retail: Use the photo of an item to find its price at different stores.
Education: Use pictures to find educational material on similar subjects.
Public safety: Automated license-plate reading.
Do you know of or heard of any other applications?
Reference:
Computer vision
https://www.research.ibm.com/artificial-intelligence/computer-vision/

© Copyright IBM Corp. 2018, 2022 12-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Computer vision tasks


• Image classification: predict that a given image belongs to a
certain class.
ƒ Example: See binary image classification demo at
https://developer.ibm.com/developer/default/articles/introduction-
computer-vision/images/hotdognothotdog.gif
í The demo shows a model that classifies an image as a hotdog or
not a hot dog.
í The video is just a sequence of images (frames). The current
frame is either recognized as a hotdog or not.
í A social media company wants to automatically identify, and
segregate objectionable images that are uploaded by users.
• Object detection and recognition: Detect certain patterns
within the image.
ƒ Examples:
í Detect red eyes when taking photos in certain conditions.
í Face recognition.
Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-8. Computer vision tasks

Image classification sees an image and can classify it (a dog, an apple, a person’s face). More
precisely, it can accurately predict that an image belongs to a certain class. For example, a social
media company might want to use it to automatically identify and separate objectionable images
that are uploaded by users.
The demo shows what you can do with a video and a simple model. Notice that instead of images,
it was built by using a video, which is just a sequence of images (frames). The current frame is
either recognized as a hotdog or not.
A CV task represents a well-defined problem in CV that can be solved to a certain extent or
accuracy by using one method or another.
Object detection and recognition deals with locating and detecting certain patterns within the
image. For example, detecting red eyes when taking photos in certain conditions. Other
applications include face detection and face recognition.
A CV task is also used in tracking objects, for example, tracking a ball during a football match,
tracking the movement of a cricket bat, or tracking a person in a video.
References:
Binary image classification demo
https://developer.ibm.com/developer/default/articles/introduction-computer-vision/images/hot
dognothotdog.gif
What is computer vision?
https://www.ibm.com/topics/computer-vision?mhsrc=ibmsearch_a&mhq=object%20detection
Introduction to computer vision
https://developer.ibm.com/articles/introduction-computer-vision/

© Copyright IBM Corp. 2018, 2022 12-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Computer vision tasks (cont.)


• Object tracking: Following the position changes of a target object from one frame to another
in an image sequence or video.
• Example: Autonomous vehicles need to not only classify and detect objects such as
pedestrians, other cars and road infrastructure, they need to track them in motion to avoid
collisions and obey traffic laws
• “Detect, track, and count cars in a video” provides an example to show you how the object
tracking code pattern is used for object detection along with object tracking to annotate a
video and count cars.

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-9. Computer vision tasks (cont.)

Object tracking is a deep learning application that follows the changes in the position of a target
object from one frame to another within an image sequence or video.
Follows or tracks an object once it is detected. This task is often run with images that are captured
in sequence or real-time video feeds. Example: Autonomous vehicles need to not only classify and
detect objects such as pedestrians, other cars, and road infrastructure, they need to track them in
motion to avoid collisions and obey traffic laws.
“Detect, track, and count cars in a video” provides an example to show you how the object
tracking code pattern is used for object detection along with object tracking to annotate a video
and count cars.
This code pattern shows you how to create and use a classifier to identify objects in motion and
then track the objects and count them as they enter designated regions of interest.

© Copyright IBM Corp. 2018, 2022 12-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty
References:
Detect, track, and count cars in a video
https://github.com/IBM/powerai-counting-cars/blob/master/README.md#detect-track-and-cou
nt-cars-in-a-video
Cars detected demo GIF
https://raw.githubusercontent.com/IBM/powerai-counting-cars/master/doc/source/images/out
put-video-as-gif.gif
Computer vision
https://en.wikipedia.org/wiki/Computer_vision
APA citation for image: Sidenbladh, H., Black, M. J., & Fleet, D. J. (2000, June). Stochastic
tracking of 3D human figures using 2D image motion. In European conference on computer vision
(pp. 702-718). Springer, Berlin, Heidelberg.
What is computer vision
https://www.ibm.com/topics/computer-vision?mhsrc=ibmsearch_a&mhq=object%20detection
Introduction to computer vision
https://developer.ibm.com/articles/introduction-computer-vision/

© Copyright IBM Corp. 2018, 2022 12-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Computer vision tasks (cont.)


• Content-based image retrieval: Image retrieval from a database based on user’s image
query.
ƒ By using image actual feature contents such as colors, shapes, and textures
ƒ Not using image metadata (keywords, tags, or descriptions)
• Optical character recognition (OCR): Converting hand-written text to a digital format.

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-10. Computer vision tasks (cont.)

Content-based image retrieval or “query-by image content” (QBIC) is the retrieval of images
from a database by using an image as a query. IBM was one of the pioneers in developing QBIC at
the IBM Almaden Research Center. "Content-based" refers to actual feature contents of the
image like colors, shapes, and textures. Other image retrieval systems rely on image metadata
such as keywords, tags, or descriptions that are associated with the image instead of image
content. Content-based image retrieval is preferred because searches that rely purely on
metadata depend on the quality of annotation.
Content-based image retrieval uses computer vision to browse, search, and retrieve images from
large data stores, based on the content of the images rather than metadata tags associated with
them. This task can incorporate automatic image annotation that replaces manual image tagging.
These tasks can be used for digital asset management systems and can increase the accuracy of
search and retrieval.
Optical character recognition (OCR): Scan papers and hand-written forms, identify the
characters in them, and transform them into digital format (strings).

References:
Content-based Multimedia Information Retrieval: State of the Art and Challenges
http://www.ugmode.com/prior_art/lew2006cbm.pdf
What is computer vision?
https://www.ibm.com/topics/computer-vision?mhsrc=ibmsearch_a&mhq=object%20detection
Digital Asset Management
https://www.ibm.com/topics/digital-asset-management

© Copyright IBM Corp. 2018, 2022 12-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Computer vision tasks (cont.)


• Image restoration: Fixing and restoring images that are corrupted by noise, such as motion
blur, to their default state.
• Scene reconstruction: Creation of a 3D model by supplying the system with multiple 2D
images from different views. The computer constructs a 3D model based on those images.

(Sinha, Steedly, Szeliskiet al. 2008) © 2008 ACM.

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-11. Computer vision tasks (cont.)

Image restoration: Fixing and restoring images that are corrupted by noise, such as motion blur,
to their default state.
Scene reconstruction: Creation of 3D model by supplying the system with multiple 2D images
from different views. The computer constructs a 3D model based on those images.
References:
Computer vision
https://en.wikipedia.org/wiki/Computer_vision
APA image citation: Sinha, S. N., Steedly, D., Szeliski, R., Agrawala, M., & Pollefeys, M. (2008,
December). Interactive 3D architectural modeling from unordered photo collections. In ACM
Transactions on Graphics (TOG) (Vol. 27, No. 5, p. 159). ACM.

© Copyright IBM Corp. 2018, 2022 12-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Computer vision tools


• OpenCV: CV open source library
ƒ C++, Python, Java, and MATLAB interfaces
• PyTorchCV is based on PyTorch framework.
ƒ Used for various computer vision tasks.
ƒ Includes a collection of pretrained models for image classification, segmentation, detection, and pose
estimation.
• scikit-image is an open source library for image processing.
ƒ Includes a set of algorithms for image processing.
ƒ Implements algorithms and utilities that are used in research, education, and industry applications.
ƒ Well-documented API in the Python programming language.

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-12. Computer vision tools

This slide provides examples of open source tools for computer vision.
• OpenCV is an open source library that can be used to perform most computer vision tasks that
are required on several languages. It includes C++, Python, Java, and MATLAB interfaces.
• PyTorchCV is based on the PyTorch framework. It is used for various computer vision tasks. It
included a collection of pretrained models for image classification, segmentation, detection,
and pose estimation.
• scikit-image is an open source image-processing library for the Python programming
language. It includes algorithms for segmentation, geometric transformations, color space
manipulation, analysis, filtering, morphology, feature detection, and more. It is available free
of charge.
References:
pytorchcv 0.0.67
https://pypi.org/project/pytorchcv/
Scikit-image
https://scikit-image.org/
scikit-image
https://en.wikipedia.org/wiki/Scikit-image

© Copyright IBM Corp. 2018, 2022 12-16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Computer vision tools (cont.)


• IBM Maximo Visual Inspection
ƒ Makes computer vision with deep learning more accessible to business users.
ƒ Includes a toolset that subject matter experts (SMEs) can use to label, train, and deploy deep learning
vision models.
ƒ No coding or deep learning expertise is required.
ƒ Benefits: Identify defects faster with visual inspection powered by AI
í Improve uptime and reduce defects
í Enable quick action and issue resolution
í Empower SMEs

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-13. Computer vision tools (cont.)

Several vendors, such as IBM, Microsoft, and Google provide computer vision offerings.
IBM Maximo Visual Inspection makes computer vision with deep learning more accessible to
business users. IBM Maximo Visual Inspection includes an intuitive toolset that empowers
subject matter experts to label, train, and deploy deep learning vision models, without coding or
deep learning expertise. It includes the most popular deep learning frameworks and their
dependencies, and it is built for easy and rapid deployment and increased team productivity. By
combining IBM Maximo Visual Inspection software with off the shelf mobile and edge devices,
enterprises can rapidly deploy a fully optimized and supported platform with excellent
performance.
Some of its benefits are:
• Improve uptime and reduce defects 
Use deep learning to analyze processes and outputs to continually improve error and defect
detection and perform root-cause analysis.
• Enable quick action and issue resolution 
AI can spot issues within milliseconds and can quickly alert the right resource to inspect,
diagnose, and rectify any issue, anywhere.
• Empower any subject matter expert
The streamlined user interface allows domain experts to easily bring data and train models.
Users with limited deep learning skills can build models for AI solutions.
For a list of use cases, see IBM Maximo Visual Inspection at
https://www.ibm.com/downloads/cas/K78GEROY

© Copyright IBM Corp. 2018, 2022 12-17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty
References:
Getting started with IBM Maximo Visual Inspection
https://developer.ibm.com/series/learning-path-powerai-vision/?mhsrc=ibmsearch_a&mhq=Get
ting%20started%20with%20IBM%20Maximo%20Visual%20Inspection
IBM Maximo Visual Inspection
https://www.ibm.com/downloads/cas/K78GEROY

© Copyright IBM Corp. 2018, 2022 12-18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Computer vision tools (cont.)


• IBM Cloud Annotations
ƒ Makes labeling images and training machine learning models easy.
ƒ Supports both photos and videos.
ƒ Object detection: An object detection model provides the following information:
í Type of object and prediction confidence level
í Location: The coordinates and area of where the object is in the image.
í Count: The number of objects found in the image.
í Size: How large the object is with respect to the image dimensions.
ƒ Object classification: An object classification model provides the following information
í Type of object and prediction confidence level
ƒ To use Cloud Annotations, go to cloud.annotations.ai and click Continue with IBM Cloud

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-14. Computer vision tools (cont.)

IBM Cloud Annotations makes labeling images and training machine learning models easy.
To train a computer vision model you need a lot of images. Cloud Annotations supports uploading
both photos and videos.
A classification model can predict what an image is and how confident it is about its decision. An
object detection model can provide you with more information:
• Location: The coordinates and area of where the object is in the image.
• Count: The number of objects found in the image.
• Size: How large the object is relative to the image dimensions.
If an object detection model provides this extra information, why to use classification?
• Labor cost: An object detection model requires humans to draw boxes around every object to
train. A classification model requires only a simple label for each image.
• Training cost: It can take longer and require more expensive hardware to train an object
detection model.
• Inference cost: An object detection model can be much slower than real time to process an
image on low-end hardware.
Cloud Annotations is built on top of IBM Cloud Object Storage. Cloud object storage provides a
reliable place to store training data. It also opens up the potential for collaboration, letting a team
to simultaneously annotate the dataset in real-time.

© Copyright IBM Corp. 2018, 2022 12-19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty
References:
Cloud Annotations
https://cloud.annotations.ai/
IBM Cloud Annotations documentation:
https://cloud.annotations.ai/docs

© Copyright IBM Corp. 2018, 2022 12-20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Computer vision use cases


• Facial recognition: We use facial recognition daily.
ƒ Taking a photo and applying effects by using your smartphone.
ƒ Tagging friends on social media.

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-15. Computer vision use cases

Facial recognition is one of the most-used features of CV. It is often used in smartphones when
you take a photo or apply effects. Another widely used feature is tagging friends on social media.
These features use face recognition and facial identification, in which a face is recognized from
the image and identifies the person in the image. A facial recognition feature can recognize faces
in an image, as shown in the figure.

© Copyright IBM Corp. 2018, 2022 12-21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Computer vision use cases (cont.)


• Augmented reality: Manipulation and addition of a system-generated image (3D or 2D) as an
overlay of a user’s view.
• Examples: Google Glass, emoji filters in some mobile apps, and Pokémon Go.
• Mobile shopping applications will give in-store shoppers instant product details and
promotions through their mobile devices.

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-16. Computer vision use cases (cont.)

Augmented reality (AR) is the manipulation and addition of a system-generated image (3D or 2D)
as an overlay of a user’s view. Examples include Google Glass, emoji filters in some mobile apps,
and Pokémon Go.
While in-store shopping accounts for 92 percent of retail volume, consumers are expecting the
same levels of personalization and customization that they do when they shop online; 58 percent
of consumers want in-store product information and 19 percent of consumers are already
browsing their mobile devices while in-store. CV and AR technology can bring all the benefits of
online shopping into traditional shops. By creating augmented reality mobile shopping
applications (apps), as shown in figure, in-store shoppers immediately learn about product details
and promotions through their mobile devices.
For more information on AR, watch the video “IBM augmented reality shopping app” at
https://youtu.be/EAVtHjzQnqY

© Copyright IBM Corp. 2018, 2022 12-22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Unit summary • Define computer vision (CV).


• Describe how CV works.
• Recount the history of CV and its advancement with artificial
intelligence (AI).
• Identify CV applications, tasks, and use cases.
• List tools and services for CV.

© Copyright IBM Corporation 2018, 2022

Figure 12-17. Unit summary

© Copyright IBM Corp. 2018, 2022 12-23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Review questions
1. One of the following items is NOT an application of CV:

a. Process claims by using images to classify claims into different categories.

b. Real-time video stream analysis that includes targeted observations, such as facial recognition and
automated license-plate reading.

c. Use images from a manufacturing setting to make sure that products are being positioned correctly
on an assembly line.

d. Sentiment analysis by analyzing the words that are posted in social media channels.

2. True or False: PyTorchCV includes pretrained models for image classification.

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-18. Review questions

© Copyright IBM Corp. 2018, 2022 12-24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Review questions (cont.)


3. Which of the following items are CV tools and services? (Select all that apply.)
a. Chatfuel.

b. API.ai.

c. OpenCV.

d. PyTorchCV.

e. scikit-image

f. All of the above

4. True or False: RNN can be used for video applications to help computers understand how
pictures in a series of frames are related to one another.

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-19. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 12-25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Review answers
1. One of the following items is NOT an application of CV:

a. Process claims by using images to classify claims into different categories.

b. Real-time video stream analysis to include targeted observations, such as facial recognition and
automated license-plate reading.
c. Use images from a manufacturing setting to make sure that products are being positioned correctly
on an assembly line.
d. Sentiment analysis by analyzing the words that are posted in social media channels.

2. True or False: PyTorchCV includes pretrained models for image classification.

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-20. Review answers

© Copyright IBM Corp. 2018, 2022 12-26


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 12. Introduction to computer vision

Uempty

Review answers (cont.)

3. Which of the following items are CV tools and services? (Select all that apply.)
a. Chatfuel.
b. API.ai.
c. OpenCV.
d. PyTorchCV.
e. scikit-image
f. All of the above

4. True or False: RNN can be used for video applications to help computers understand how
pictures in a series of frames are related to one another.

Introduction to computer vision © Copyright IBM Corporation 2018, 2022

Figure 12-21. Review answers (cont.)

© Copyright IBM Corp. 2018, 2022 12-27


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Unit 13.Computer vision fundamentals


Estimated time
00:30

Overview
This unit explains the basic steps of a typical computer vision (CV) pipeline, how CV analyzes and
processes images, and explores commonly used techniques in CV.

© Copyright IBM Corp. 2018, 2022 13-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Unit objectives • Describe image representation for computers.


• Describe the computer vision (CV) pipeline.
• Describe different preprocessing techniques.
• Explain image segmentation.
• Explain feature extraction and selection.
• Explain image classification.

© Copyright IBM Corporation 2018, 2022

Figure 13-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 13-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Topics • Image representation


• Computer vision pipeline

© Copyright IBM Corporation 2018, 2022

Figure 13-2. Topics

© Copyright IBM Corp. 2018, 2022 13-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty
13.1.Image representation

© Copyright IBM Corp. 2018, 2022 13-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Image
representation

Figure 13-3. Image representation

© Copyright IBM Corp. 2018, 2022 13-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Image representation
• Images are stored as a 2D array of pixels on computers.
• Each pixel has a certain value that represent its intensity.
• Example of grayscale representation:
ƒ Image is black and white with shades of gray in between.
ƒ Pixel intensity is a number between 0 (black) and 255 (white).

int[ ][ ] array = { {255, 170, 170, 0},


{220, 80, 80, 170},
{255, 80, 0, 0},
{175, 20, 170, 0} };

Computer vision fundamentals © Copyright IBM Corporation 2018, 2022

Figure 13-4. Image representation

It is important to understand how images are stored and represented on computer screens.
Images are made of grids of pixels, that is, a two-dimensional (2D) array of pixels, where each
pixel has a certain value that represents its intensity. A pixel represents a square of color on the
user’s screen. Colors can be represented in image in various ways.
If the image is grayscale, that is, black and white with shades of gray in between, the intensity is a
number in the range 0 - 255, where 0 represents black and 255 represents white. The numbers in
between these two values are different intensities of gray.
For example, in the picture in the slide, assume that you selected a small square from the image
(the part in the red square). The pixel representation for it is in black, white, and shades of gray. To
the right of the picture is the numeric values of these pixels in a 2D array.

Note

The 256 scaling is a result of using 8-bit storage (28 =256).

© Copyright IBM Corp. 2018, 2022 13-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty
References:
Data Representation
https://www.csfieldguide.org.nz/en/chapters/data-representation/
Colour Models
https://www.sqa.org.uk/e-learning/BitVect01CD/page_36.htm
Image reference
https://www.mathworks.com/help/examples/images/win64/SegmentGrayscaleImageUsingKMe
ansClusteringExample_01.png

© Copyright IBM Corp. 2018, 2022 13-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Image representation (cont.)


• Example of color representation:
ƒ The pixel color is represented as a mix of Red, Green, and Blue.
ƒ The pixel intensity becomes three 2D arrays or one 2D array, where each entry is an object containing
the 3 color values of RGB

three 2D array one 2D array


Computer vision fundamentals © Copyright IBM Corporation 2018, 2022

Figure 13-5. Image representation (cont.)

Many color models are available for colored images. The best-known model is RGB, where the
color of the pixels is represented as a mix of Red, Blue, and Green color channels. The value of the
pixel intensity is represented as three 2D arrays that represent the three color channels, where
each color value is in the range 0 – 255. The color value represents different intensities of the
colors and all the colors that you see on the screen. The number of color variations that are
available in RGB is 256 * 256 *256 = 16,777,216 possible colors.
Depending on the data structure used that image appears as
• Three 2D arrays, where each 2D array represents the values and intensities for one color. The
image is a combination of all three arrays.
• One 2D array, where each entry in the array is an object that contains three color values of
RGB.

References:
Data Representation
https://www.csfieldguide.org.nz/en/chapters/data-representation/
Colour Models
https://www.sqa.org.uk/e-learning/BitVect01CD/page_36.htm
How MATLAB Represents Pixel Colors
https://www.mathworks.com/company/newsletters/articles/how-matlab-represents-pixel-color
s.html

© Copyright IBM Corp. 2018, 2022 13-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty
13.2.Computer vision pipeline

© Copyright IBM Corp. 2018, 2022 13-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Computer vision
pipeline

Figure 13-6. Computer vision pipeline

© Copyright IBM Corp. 2018, 2022 13-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Computer vision pipeline


• The steps and functions that are included are highly dependent on the application.
• Here is a conventional visual pattern recognition pipeline.

Feature
Image Pre-
Segmentation Extraction Classification
Acquisition Processing
& Selection

Computer vision fundamentals © Copyright IBM Corporation 2018, 2022

Figure 13-7. Computer vision pipeline

The steps and functions that are included in a CV system algorithm pipeline are highly dependent
on the application. The application might be implemented as a stand-alone part of a system and
might apply to only a certain step of the pipeline, or it can be a larger application, that is, an
end-to-end application that takes certain images and then applies all of the steps and functions in
the pipeline.
Reference:
Hardware Architecture for Real-Time Computation of Image Component Feature Descriptors on a
FPGA
https://www.researchgate.net/publication/273596152_Hardware_Architecture_for_Real-Time_
Computation_of_Image_Component_Feature_Descriptors_on_a_FPGA

© Copyright IBM Corp. 2018, 2022 13-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Computer vision pipeline (cont.)


1. Image acquisition:
í The process of acquiring images and saving them in a digital image format for processing.
í Images often use common formats, such as .jpeg, .png, and .bmp.
í Images are 2D images that are stored as arrays of pixels according to their color model.

Computer vision fundamentals © Copyright IBM Corporation 2018, 2022

Figure 13-8. Computer vision pipeline (cont.)

1. Image acquisition
Image acquisition is the process of acquiring images and saving them in a digital image format for
processing in the pipeline.
Images are acquired from image sensors, such as commercial cameras. Other types of
light-sensitive devices can be used to capture different types of images. Other image sensors
include radar, which uses radio waves for imaging.
Depending on the type of the device, the captured image can be 2D, 3D, or a sequence of images.
These images often use common formats, such as .jpeg, .png, and .bmp.
Images are stored as arrays of pixels according to their color model.
Reference:
System methods
https://en.wikipedia.org/wiki/Computer_vision#System_methods

© Copyright IBM Corp. 2018, 2022 13-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Computer vision pipeline (cont.)


2. Pre-processing:
ƒ Preparing the image for the processing stage
ƒ Examples:
í Resizing images
í Noise reduction
í Contrast adjustment

Computer vision fundamentals © Copyright IBM Corporation 2018, 2022

Figure 13-9. Computer vision pipeline (cont.)

2. Pre-processing:
This stage focuses on preparing the image for the processing stage.
Examples:
• Images are resized as a form of normalization so that all images are the same size.
• Noise reduction reduces noise that represents false information in the image, as shown in the
slide.
• Contrast adjustment helps with the detection of image information. In the images of the little
girl, each image represents a different contrast adjustment.
Image source: https://www.mathworks.com/help/images/contrast-adjustment.html
Reference:
System methods
https://en.wikipedia.org/wiki/Computer_vision#System_methods

© Copyright IBM Corp. 2018, 2022 13-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Computer vision pipeline (cont.)


3. Segmentation:
í Partitioning an image into regions of similarity.
í Grouping pixels and features with similar characteristics together.
í Helps with selecting regions of interest within the images. These regions can contain objects of
interest that you want to capture.
í Segmenting an image into foreground and background.

(Cremers, Rousson, and Deriche 2007) © 2007 Springer


Computer vision fundamentals © Copyright IBM Corporation 2018, 2022

Figure 13-10. Computer vision pipeline (cont.)

3. Segmentation
The position of the image segmentation phase is not fixed in the CV pipeline. It might be a part of
the pre-processing phase or follow it or be part of the feature extraction and selection phase or
follow them.
Segmentation is one of the oldest problems in CV and has the following aspects:
• Partitioning an image into regions of similarity.
• Grouping pixels and features with similar characteristics together.
• Helps with selecting regions of interest within the images. These regions can contain objects
of interest that you want to capture.
• Segmenting an image into foreground and background to apply further processing on the
foreground.
Image citation: Cremers, D., Rousson, M., & Deriche, R. (2007). A review of statistical approaches
to level set segmentation: integrating color, texture, motion and shape. International journal of
computer vision, 72(2), 195-215.

© Copyright IBM Corp. 2018, 2022 13-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty
References:
Computer vision
https://en.wikipedia.org/wiki/Computer_vision
Computer Vision: Algorithms and Applications
http://www.cs.ccu.edu.tw/~damon/tmp/SzeliskiBook_20100903_draft.pdf
Segmentation of Images
http://www.cse.iitm.ac.in/~vplab/courses/CV_DIP/PDF/lect-Segmen.pdf

© Copyright IBM Corp. 2018, 2022 13-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Computer vision pipeline (cont.)


4. Feature extraction and selection:
í Find distinguishing information about the image.
í Image features examples: distinct color in an image or a specific shape such as a line, edge, corner,
or an image segment.

Computer vision fundamentals © Copyright IBM Corporation 2018, 2022

Figure 13-11. Computer vision pipeline (cont.)

4. Feature extraction and selection


In computer vision, a feature is a measurable piece of data in your image, which is unique to this
specific object. It can be a distinct color in an image or a specific shape such as a line, edge,
corner, or an image segment. A good feature is used to distinguish objects from one another.
The objective is to transform the raw data (image) into a features vector so that the learning
algorithm learns the characteristics of the object.
Typical examples of such features are:
• Lines and edges: These features are where sharp changes in brightness occur. They represent
the boundaries of objects.
• Corners: These features are points of interest in the image where intersections or changes in
brightness happens.
These corners and edges represent points and regions of interest in the image.
Brightness in this context refers to changes in the pixel intensity value.

© Copyright IBM Corp. 2018, 2022 13-16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty
References:
Computer Vision Pipeline, Part 1: the big picture
https://freecontent.manning.com/computer-vision-pipeline-part-1-the-big-picture/
The Computer Vision Pipeline, Part 4: feature extraction
https://freecontent.manning.com/the-computer-vision-pipeline-part-4-feature-extraction/
Detection
https://en.wikipedia.org/wiki/Feature_(computer_vision)#Detectors
Edge Detection
https://www.mathworks.com/discovery/edge-detection.html
Computer vision
https://en.wikipedia.org/wiki/Computer_vision
Image reference: https://www.mathworks.com/discovery/edge-detection.html

© Copyright IBM Corp. 2018, 2022 13-17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Computer vision pipeline (cont.)


• Some extracted features might be irrelevant or redundant.
• Feature selection follows feature extraction.
• Feature selection is choosing a feature subset that can reduce dimensionality with the least
amount of information loss.

All Features Selection Selected


Techniques Features

Computer vision fundamentals © Copyright IBM Corporation 2018, 2022

Figure 13-12. Computer vision pipeline (cont.)

For feature extraction, all the features in the image that could be extracted are present. Now, start
selecting the features that are of interest. Some extracted features might be irrelevant or
redundant.
Here are some reasons to perform feature selection:
• Reduce the dimensions of the features that were extracted from the image.
• Avoid overfitting when training the model with the features.
• Create simpler models with less training time.
References:
Feature selection
https://en.wikipedia.org/wiki/Feature_selection
Application of high-dimensional feature selection: evaluation for genomic prediction in man
https://www.nature.com/articles/srep10312

© Copyright IBM Corp. 2018, 2022 13-18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Computer vision pipeline (cont.)


5. Classification:
í The extracted features are used to classify the image.
í More processing might be done on the classified images to identify more features from the image.
í Example: After face detection, identify features on the face, such as hair style, age, and gender.

Computer vision fundamentals © Copyright IBM Corporation 2018, 2022

Figure 13-13. Computer vision pipeline (cont.)

5. Classification: Image classification is a practice in computer vision. It focuses on classifying


an image according to its visual content.
Further processing is done on the classified images to identify more features from the image. For
example, after the image is classified to detect the face region, identify features on the face such
as hair style, age, and gender.
Reference:
Image Classification
https://www.sciencedirect.com/topics/computer-science/image-classification

© Copyright IBM Corp. 2018, 2022 13-19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Decision making
• Apply logic to make decisions based on detected images.
• Examples:
ƒ Security application: Grant access based on face recognition.
ƒ In a greenhouse environment, a notification is sent to the engineers to act if a plant is detected as
suffering from decay.

Computer vision fundamentals © Copyright IBM Corporation 2018, 2022

Figure 13-14. Decision making

Decision making
After getting the output from the CV pipeline, users can apply logic that is based on the findings to
make decisions based on detected images.
For example, in security applications, the system can decide to grant access to a person if a face
that is detected is identified as the owner of a facility.
Another example is in a greenhouse environment, where a notification is sent to the engineers to
act if a plant is detected as suffering from decay.

© Copyright IBM Corp. 2018, 2022 13-20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Unit summary • Describe image representation for computers.


• Describe the computer vision (CV) pipeline.
• Describe different preprocessing techniques.
• Explain image segmentation.
• Explain feature extraction and selection.
• Describe when object recognition takes place.

© Copyright IBM Corporation 2018, 2022

Figure 13-15. Unit summary

© Copyright IBM Corp. 2018, 2022 13-21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Review questions
1. True or False: There is only one model to represent color in images, which is the RGB color
model.
2. True or False: In feature extraction, one of the reasons to perform feature selection is to avoid
overfitting when training the model.
3. True or False: In a CV pipeline, classification deals with extracting a measurable piece of data
in your image.
4. Which of the following items is not an example of feature extraction:
a. Shape
b. Color
c. Lines and edges
d. Noise

Computer vision fundamentals © Copyright IBM Corporation 2018, 2022

Figure 13-16. Review questions

© Copyright IBM Corp. 2018, 2022 13-22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Review answers
1. True or False: There is only one model to represent color in images, which is the RGB color
model.
2. True or False: In feature extraction, one of the reasons to perform feature selection is to avoid
overfitting when training the model.
3. True or False: In the CV pipeline, classification deals with extracting a measurable piece of
data in your image.
4. Which of the following items is not an example of feature extraction:
a. Shape
b. Color
c. Lines and edges
d. Noise

Computer vision fundamentals © Copyright IBM Corporation 2018, 2022

Figure 13-17. Review answers

© Copyright IBM Corp. 2018, 2022 13-23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty
Exercise: Using a basic deep neural network to solve an
image recognition problem

Figure 13-18. Exercise: Using a basic deep neural network to solve an image recognition problem

© Copyright IBM Corp. 2018, 2022 13-24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 13. Computer vision fundamentals

Uempty

Exercise • In this exercise, you use a simple deep neural network to solve an
image recognition problem. Here, the focus is more on the overall
objectives technique and use of a library than on perfecting the model.
• After completing this exercise, you should be able to:
ƒ Perform image recognition tasks by using deep learning.
ƒ Use Tensorflow and Keras libraries.
ƒ Prepare and preprocess an image data set.
ƒ Visualize data.
ƒ Build, compile, and train a neural network.
ƒ Make predictions and test a model.

© Copyright IBM Corporation 2018, 2022

Figure 13-19. Exercise objectives

© Copyright IBM Corp. 2018, 2022 13-25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Unit 14.Designing and building an


intelligent solution
Estimated time
01:00

Overview
This unit explains the benefits of integrating multiple Watson services to build a comprehensive
intelligent solution. This unit presents examples of intelligent solutions use cases and introduces
their architecture and main integration points.

© Copyright IBM Corp. 2018, 2022 14-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Unit objectives • Explain the need to integrate multiple IBM Watson services to build
an intelligent solution.
• Describe the general flows for the integration of IBM Watson
Assistant with other services and applications.
• Explain the key capabilities that enable Watson Assistant
integration.
• Describe the flow to build a cognitive chatbot banking application by
integrating Watson Assistant, Watson Discovery, Watson Natural
Language Understanding, and back-end banking services.
• Describe the flow to build an intelligent procurement system by
integrating Watson Knowledge Studio and Watson Discovery.
• Describe the flow to build a movie recommender system by
integrating Watson Assistant, Watson Studio, Machine Learning, IBM
Db2 database and by using Node-RED flows.

© Copyright IBM Corporation 2018, 2022

Figure 14-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 14-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Topics • Integrating IBM Watson services to build a solution


• Watson Assistant integration with other services
• Building a cognitive chatbot banking app: Integrating Watson
Assistant, Watson Discovery, Natural Language Understanding, and
back-end banking services
• Building an intelligent procurement system by integrating
Knowledge Studio and Watson Discovery
• Building a movie recommender solution with Watson Assistant,
Watson Studio, Machine Learning, Db2, and Node-RED

© Copyright IBM Corporation 2018, 2022

Figure 14-2. Topics

© Copyright IBM Corp. 2018, 2022 14-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty
14.1.Integrating IBM Watson services to build a
solution

© Copyright IBM Corp. 2018, 2022 14-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Integrating IBM
Watson services to
build a solution

Figure 14-3. Integrating IBM Watson services to build a solution

This section describes the benefits of integrating multiple AI services and introduces typical
applications that you can create by combining multiple Watson services.

© Copyright IBM Corp. 2018, 2022 14-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Benefits
• A single Watson service adds artificial intelligence (AI) capabilities to the application in one
specific area.
• Integrating multiple Watson services adds more than one AI capability to the application,
which enhances the application with richer cognitive capabilities.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-4. Benefits

Using one Watson service adds artificial intelligence (AI) capabilities to the application in one
specific area.
Integrating multiple Watson services adds more than one AI capability to the application, which
enhances the application with richer cognitive capabilities.

© Copyright IBM Corp. 2018, 2022 14-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Building solutions with Watson services


• Watson services on IBM Cloud are a set of REST APIs:
• Easy to integrate as solution components.
• Must be integrated with other parts of a solution, for example, back-end systems, social media
channels, and more.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-5. Building solutions with Watson services

Watson services on IBM Cloud are a set of REST APIs. They are easy to use as a component of a
solution within an application. They must be integrated with various other parts of the solution so
that your users can interact with your instance of the Watson service.
The figure shows examples of applications that can be built by integrating multiple Watson
services:
• Sentiment, emotion, and tone analytics: This application integrates the Watson Natural
Language Understanding service with Twitter to process tweets from users and analyze
sentiment and emotion.
• Real-time transcription: This Android application performs real-time transcription and
translation by integrating IBM Watson Speech to Text, IBM Watson Text to Speech, and IBM
Watson Language Translator services.
• An application orchestrates the services integration and provides the logic of the solution.
Reference:
IBM architecture diagrams
https://www.ibm.com/cloud/architecture/architectures/edit/powerpoint

© Copyright IBM Corp. 2018, 2022 14-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Resources for the integration of Watson services


Assets that are available to assist with the integration:
• Watson SDKs
• API Reference and documentation
• Watson Starter Kits

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-6. Resources for the integration of Watson services

Although IBM provides several assets to help the integration effort, such as Watson SDKs, API
references, and sample applications, other users contributed GitHub repositories too. The
possibilities for the integration of Watson services with other channels or specific external
systems are endless.
It is not possible to cover the broad range of options and possibilities for integrating Watson
services. This presentation provides an introduction to Watson services integration and an
example that is implemented in the exercise that follows the presentation.
References:
Watson SDKs
https://cloud.ibm.com/docs/watson?topic=watson-using-sdks
API reference and documentation
https://cloud.ibm.com/developer/watson/documentation
Watson Starter Kits
https://cloud.ibm.com/developer/watson/starter-kits

© Copyright IBM Corp. 2018, 2022 14-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty
14.2.Watson Assistant integration with other
services

© Copyright IBM Corp. 2018, 2022 14-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Watson Assistant
integration with
other services

Figure 14-7. Watson Assistant integration with other services

This section introduces the integration of Watson Assistant with other Watson services and
channels.

© Copyright IBM Corp. 2018, 2022 14-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Watson Assistant integration: General outline

Application

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-8. Watson Assistant integration: General outline

Although it is impossible to describe how to integrate with every possible integration point, there
is a general outline that most integrations follow. The following major components are parts of a
solution that integrates chatbots with other services and applications:
1. Front end or channel: This component can be a web page or an application window where the
users type their questions, the responses are shown, images are displayed, and so on. It might
be a messaging channel, an embedded chat widget, a mobile app, or even SMS messaging.
2. Watson Assistant: The “intelligence” behind the interaction is the Watson Assistant service.
Watson Assistant takes the inputs, understands them, and drives what takes place next. Some
examples of the output are displaying a response, detecting the intent of what is being asked,
using a multi-modal interaction like showing a map, playing a video, or something more
complex, such as reading from and writing to a database or even calling an enterprise service.
Watson Assistant can be trained on your content, but the interaction follows some structure.
Depending upon the content source or type, you might have to use some data transformation
or connectivity patterns.
3. Application layer: This is the middle layer, which varies the most across different solutions.
There is one job that this layer must accomplish: Passing information from the front end to
the chatbot (Watson Assistant), including system context, and passing it back to carry the
conversation. It is a translation layer that moves data from one side to the other and back.
4. Pre-processing: The flow gets more complex if you have additional interactions that you want
to integrate. For example, suppose that you want to add Tone analytics to build an empathetic
chatbot. This action is typically called pre-processing because it happens before calling
Watson Assistant. The application layer takes the user input, runs it through this
pre-processor layer, in this case to get the tone of the user statement, attaches the response,
in this case tone analytics’ results as context for Watson Assistant, and then pass it on to
Watson Assistant.

© Copyright IBM Corp. 2018, 2022 14-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty
5. Post-processing: This is the step where the logic that is necessary to respond to the user
query is. It happens after calling Watson Assistant but before returning a response to the
front-end layer. The Watson Discovery service is an example of a post-processing service.
Another use case for the post-processing layer is writing information to a database. For
example, a user orders a large pepperoni pizza. Your application might have to make two
callouts. The first call places the order in your point of sale (POS) system to order the pizza,
and the second call might write the order to a database. This way, the next time the user logs
in, they can say “order my usual” or something similar. Watson Assistant typically returns
some action for your application to perform and it also returns some text. Your application can
do the activities that are defined, and then show a message such as “I’ll remember that it is
your favorite, and it’s on the way. Thank you for your order.” Another approach is to directly
call external services from the Watson Assistant dialog to enrich your conversation or allow
users to complete activities by using post-processing.

Information

For detailed information on planning, preparing, runtime, and security architectures for Watson
Assistant integrations, see “Conversational chatbot reference architecture” at
https://www.ibm.com/cloud/architecture/architectures/cognitiveConversationDomain/reference
-architecture

Reference:
Integrate Watson Assistant With Just About Anything
https://medium.com/ibm-watson/integrate-watson-assistant-with-just-about-anything-695bc1
d29875
Natural Language Understanding – Tone analytics
https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understan
ding-tone_analytics
Conversational chatbot reference architecture
https://www.ibm.com/cloud/architecture/architectures/cognitiveConversationDomain/reference
-architecture

© Copyright IBM Corp. 2018, 2022 14-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Customer experience integrations


• Watson Assistant is designed to
extend and enhance your customer
service applications and resources.
ƒ Seamlessly connect to existing customer
support systems.
ƒ Subject matter experts can build and
maintain advanced conversational flows,
without developer help.
ƒ Improve the quality of the response by
accessing existing organizational
knowledge that was collected over years of
experience.
ƒ Integrate with tools and apps from other
vendors or build your own.
ƒ Improve the customer experience by
responding to customer inquiries through
phone or digital channels and routing to
the right agent as necessary.
Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-9. Customer experience integrations

Watson Assistant is designed to extend and enhance your current customer service applications
and resources. Go beyond simply giving customers and agents the answers that they need by
helping them solve real problems with chatbots advanced enough to interact with your customer
care ecosystem over the course of a natural conversation.
Seamlessly connect to existing customer support systems to fulfill customer requests and
perform tasks within the assistant itself.
Empower subject matter experts (SMEs) to build and maintain advanced conversational flows,
without developer help.
Improve the quality of the response by accessing existing organizational knowledge that was
collected over years of experience.
Integrate with tools and apps from other vendors or build your own.
Improve the customer experience by responding to customer inquiries through phone or digital
channels and routing to the right agent if necessary.
Reference:
Customer experience integrations
https://www.ibm.com/products/watson-assistant/integrations?mhsrc=ibmsearch_a&mhq=assis
tant%20integration

© Copyright IBM Corp. 2018, 2022 14-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Key concepts to enable Watson Assistant integration


Communicating with the Watson services:
• Create a wrapper for the Watson service.
• Specify the service credentials.
• Specify the service version.
• Watson SDKs provide mechanisms for instantiating a service wrapper for several programming
languages.
• Example for Watson Assistant in Node.js:
// Sets up Assistant service wrapper
const AssistantV1 = require('ibm-watson/assistant/v1');
const { IamAuthenticator } = require('ibm-watson/auth');

const assistant = new AssistantV1({


version: '{version}',
authenticator: new IamAuthenticator({
apikey: '{apikey}',
}),
serviceUrl: 'https://api.us-east.assistant.watson.cloud.ibm.com',
});
Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-10. Key concepts to enable Watson Assistant integration

The first step is to create a wrapper for the Watson Assistant service.
The wrapper is an object to which you send input and receive output from the service. When you
create the service wrapper, specify the authentication credentials from the service credentials
and version that you use.
In this Node.js example, the wrapper is an instance of AssistantV1, which is stored in the
variable assistant.
The Watson SDKs for other languages provide equivalent mechanisms for instantiating a service
wrapper.
Reference:
Watson Assistant API documentation
https://cloud.ibm.com/apidocs/assistant-v1?code=node

© Copyright IBM Corp. 2018, 2022 14-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Key concepts to enable Watson Assistant integration (cont.)


Context:
• It maintains state information.
• It is an object that is passed back and forth between your application and the Watson
Assistant service.
• Your application must maintain the context from one turn of the conversation to the next.
• Also used to store other data that you want to pass between your application and the Watson
Assistant service. Examples:
ƒ Persistent data that you want to maintain throughout the conversation, such as a customer's name or
account number.
ƒ Any data that you want to track, such as the status of the option settings.
• In each round of the conversation, send back the context object that was received in the
previous round.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-11. Key concepts to enable Watson Assistant integration (cont.)

State information for your conversation is maintained by using the context. The context is an
object that is passed between your application and the Watson Assistant service. It is the
responsibility of your application to maintain the context from one turn of the conversation to the
next. The context includes a unique identifier for each conversation with a user, and a counter that
is incremented with each turn of the conversation.
In addition to maintaining your place in the conversation, the context can also be used to store
any other data that you want to pass between your application and the Watson Assistant service.
This information can include persisting the data that you want to maintain throughout the
conversation (such as a customer's name or account number), or any other data that you want to
track (such as the status of option settings).
The context contains variables that are meant to be persistent. To pass information from one call
to the next, the application developer must pass the previous API call's response context with
each subsequent API call. For example, the dialog can collect the user's name and then refer to
the user by name in subsequent nodes.
Reference:
Watson Assistant API documentation
https://cloud.ibm.com/apidocs/assistant-v1?code=node

© Copyright IBM Corp. 2018, 2022 14-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Key concepts to enable Watson Assistant integration (cont.)


Context variable:
ƒ A context variable is a variable that you define in a dialog node or from an application.
ƒ Optionally, you can specify a default value for a context variable.
ƒ Nodes and application logic can change its value.
ƒ Example: Your application sets a $time_of_day context variable, and passes it to the dialog node,
which can use the information to tailor the greeting it displays to the user.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-12. Key concepts to enable Watson Assistant integration (cont.)

A context variable is a variable that you define in a node or in the application, and optionally
specify a default value for it.
You can pass information from the application to the dialog by setting a context variable and
passing the context variable to the dialog.
For example, your application can set a $time_of_day context variable, and pass it to the dialog,
which can use the information to tailor the greeting it shows to the user.
In this example, the dialog knows that the application sets the variable to one of these
values: morning, afternoon, or evening. It can check for each value, and depending on which value
is present, return the appropriate greeting. If the variable is not passed or has a value that does
not match one of the expected values, then a more generic greeting is displayed to the user.
The dialog can also add context variables to pass information from one node to another or to
update the values of context variables. As the dialog asks for and gets information from the user, it
can track the information and reference it later in the conversation. For example, in one node you
might ask users for their name, and in a later node address them by name.
References:
Create natural conversations between your apps and users
https://www.ibm.com/cloud/garage/architectures/cognitiveConversationDomain

© Copyright IBM Corp. 2018, 2022 14-16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Key concepts to enable Watson Assistant integration (cont.)


Using intents, entities, and context for application and Watson Assistant integration:
• Watson Assistant identifies intents and entities in the user’s input.
• The Watson Assistant dialog passes intent, entities, and context to the application.
• The application performs specific tasks that are based on intent, entity, and context values.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-13. Key concepts to enable Watson Assistant integration (cont.)

In general, any integration between the application and Watson Assistant is done by using intents,
entities, and context objects:
• Watson Assistant dialog detects the intents and entities in the user’s response.
• Watson Assistant dialog passes the intents, entities, and context objects to the application in
JSON format.
• The application performs specific tasks according to the intents, entities, and context values
that are sent to the application.

© Copyright IBM Corp. 2018, 2022 14-17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Key concepts to enable Watson Assistant integration (cont.)


• Callback function:
ƒ A function that is passed into another function as an argument.
ƒ A callback function is called at the completion of a task.
• Using the callback function for application and Watson Assistant integration:
ƒ Application calls the assistant.message API by passing the payload object and callback function
in its arguments.
ƒ Watson Assistant processes the task, sets the output, intents, entities, and context in the response,
and then returns to the callback function.
ƒ The response is processed by the application in the callback function.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-14. Key concepts to enable Watson Assistant integration (cont.)

Callback is an asynchronous equivalent for a function. A callback function is called at the


completion of a task.
The callback function is used in the application and Watson Assistant integration:
1. The application calls the assistant.message API by passing the payload object and the
callback function in its arguments.
2. Watson Assistant processes the task and sets the output, which is the chatbot response,
intents, entities, and context in the response to the API, and then returns back to the callback
function.
3. In the callback function, the response containing the output, intents, entities, and context is
processed.

© Copyright IBM Corp. 2018, 2022 14-18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Extending your assistant with webhooks


• Make a call to an external service or application during a conversation.
• Watson Assistant supports the following types of webhooks:
ƒ Skill-level webhooks. The following type of webhook can be set up for use from a dialog skill:
í Dialog
ƒ Assistant-level webhooks. The following types of webhooks can be set up for an assistant:
í Premessage
í Postmessage
í Logs

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-15. Extending your assistant with webhooks

A webhook is a mechanism that allows you to call out to an external program based on events in
your program. You can use webhooks to make calls from your assistant to an external service or
application during a conversation.
Watson Assistant supports the following types of webhooks:
Skills level webhooks. The following type of webhook can be set up for use from a dialog skill:
• Dialog
When used in a dialog skill, a webhook is triggered when the assistant processes a node that
has a webhook that is enabled. The webhook collects data that you specify or that you collect
from the user during the conversation and save in context variables. It sends the data as part
of an HTTP POST request to the URL that you specify as part of your webhook definition. The
URL that receives the webhook is the listener. It performs a predefined action by using the
information that you pass to it as specified in the webhook definition, and can optionally return
a response.

© Copyright IBM Corp. 2018, 2022 14-19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty
Assistant-level webhooks. The following types of webhooks can be set up for an assistant:
• Premessage
Add a premessage webhook to your assistant if you want the webhook to be triggered before
each incoming message is processed by your assistant.
A premessage webhook calls an external service or application every time a customer submits
input. The external service can process the message before it is processed by your assistant.
For example, you can use a premessage webhook to:
Translate the customer's input to the language that is used by your assistant.
Check for and remove any personally identifiable information, such as an email address or
social security number that a customer might submit.
• Postmessage
A postmessage webhook calls an external service or application every time a response is
rendered by the assistant. The external service can process the assistant output before it is
sent to the channel.
For example, you can use a postmessage to extract custom responses from an external
content repository. For example, you can define actions with custom IDs in the responses
instead of text. The postmessage webhook can pass these IDs to an external database to
retrieve stored text responses.
• Logs
You can log activity by calling an external service or application every time a customer submits
input to the assistant.
This feature is available only to Enterprise plan users.
References:
Extending your assistant with webhooks
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-webhook-overview
Webhook overview
https://cloud.ibm.com/docs/assistant?topic=assistant-webhook-overview
Making a programmatic call from dialog
https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-webhooks
Making a call before processing a message
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-webhook-pre
Making a call after processing a message
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-webhook-post
Logging activity with a webhook
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-webhook-log

© Copyright IBM Corp. 2018, 2022 14-20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Making programmatic calls from a dialog node


• Calling external applications or services.
ƒ To make a programmatic call, define a webhook that sends a POST request callout to an external
application that performs a function programmatically.
• Use cases:
ƒ Include the weather forecast in the chatbot.
ƒ Validate information that was collected from the user.
ƒ Perform calculations.
ƒ Check a flight status that is provided by an air traffic service.
ƒ Interact with an external application, for example, restaurant reservations.
• Approaches for integration:
ƒ Create an orchestration application that acts as the middle layer between Watson Assistant and the
external service.
ƒ Call the external service directly from Watson Assistant dialog node.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-16. Making programmatic calls from a dialog node

External applications or services might be called for several reasons to achieve richer interactions
in the chatbot’s dialogs. The typical way of achieving such integration is to create
an orchestration application. This orchestration application is the glue logic between Watson
Assistant and an external service. This approach is described in this presentation and the exercise
that follows.
References:
Making a programmatic call from dialog
https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-webhooks
Extending your assistant with webhooks
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-webhook-overview
Webhook overview
https://cloud.ibm.com/docs/assistant?topic=assistant-webhook-overview

© Copyright IBM Corp. 2018, 2022 14-21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Making programmatic calls from dialog nodes (cont.)


• Define a webhook that sends a POST request callout to an external application that performs a
programmatic function.
• The request body and the response must be a JSON object.
• You define the webhook in the dialog and invoke the webhook from one or more dialog nodes.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-17. Making programmatic calls from dialog nodes (cont.)

To make a programmatic call, define a webhook that sends a POST request callout to an external
application that performs a programmatic function. You can then invoke the webhook from one or
more dialog nodes.
To set up a webhook from the Dialog > Webhooks page, specify the request URL for an external
API you want to be able to invoke from dialog nodes.
When used in a dialog skill, a webhook is triggered when the assistant processes a node that has a
webhook that is enabled. The webhook collects data that you specify or that you collect from the
user during the conversation and save in context variables. It sends the data as part of an HTTP
POST request to the URL that you specify as part of your webhook definition. The URL that
receives the webhook is the listener. It performs a predefined action by using the information that
you pass to it as specified in the webhook definition and can optionally returns a response.
References:
Making a programmatic call from dialog
https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-webhooks#dialog-webhooks-dialo
g-node-callout

© Copyright IBM Corp. 2018, 2022 14-22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Making programmatic calls from a dialog node (cont.)


• IBM Cloud Functions:
ƒ A Function-as-a-Service (FaaS) platform based on Apache OpenWhisk that runs functions in response
to incoming events or direct invocations.
ƒ Provide a set of small, distinct, and independent actions.
ƒ Developers focus on the application logic and creating actions that are run on demand.
ƒ Cloud Functions focus on the event-driven computing paradigm wherein application code, or
containers, only run in response to events or requests.
ƒ Cloud Functions actions can be called from a dialog node.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-18. Making programmatic calls from a dialog node (cont.)

Another approach for integration is for a Watson Assistant dialog node to call the external service
directly. This approach enables your client application to call the external service or use IBM
Cloud Functions.
IBM Cloud Functions are based on Apache OpenWhisk. It is a Function-as-a-Service (FaaS)
platform that runs functions in response to incoming events or direct invocations.
References:
Getting started with IBM Cloud Functions
https://cloud.ibm.com/docs/openwhisk
FaaS (Function-as-a-Service)
https://www.ibm.com/cloud/learn/faas
Cloud Functions concepts
https://cloud.ibm.com/functions/learn/concepts
Calling an IBM Cloud Functions web action
https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-webhooks#dialog-webhooks-cf-w
eb-action

© Copyright IBM Corp. 2018, 2022 14-23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Watson Assistant integration architecture with Cloud Functions

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-19. Watson Assistant integration architecture with Cloud Functions

The figure shows the general outline for integration introduced earlier in this presentation but in
this case, the architecture includes IBM Cloud Functions as the orchestration component. In this
case, Watson Assistant calls the external service directly by using Cloud Functions.

© Copyright IBM Corp. 2018, 2022 14-24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty
Integrating the new Watson Assistant with other services by
using extensions
• To integrate your assistant with an external service that has a REST API, you can build a
custom extension by importing an OpenAPI document.
• After you create a custom extension, you can connect it to an assistant as an integration.
• In the actions, you can then define steps that interact with the external service by calling the
extension
• The Watson Assistant extension starter kit repo on GitHub provides files that you can use to
quickly build a working extension.
ƒ Each starter kit includes a tested OpenAPI definition that you can use to create an extension that
accesses a third-party API, along with a downloadable JSON file that you can import to create an
assistant that accesses the extension..

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-20. Integrating the new Watson Assistant with other services by using extensions

Overview
OpenAPI (formerly known as Swagger) is an open standard for describing and documenting REST
APIs. An OpenAPI document defines the resources and operations that are supported by an API,
including request parameters and response data, along with details such as server URLs and
authentication methods.
An OpenAPI document describes a REST API in terms of paths and operations. A path identifies a
particular resource that can be accessed by using the API (for example, a hotel reservation or a
customer record), while an operation defines a particular action that can be performed on that
resource (such as creating, retrieving, updating, or deleting it). The OpenAPI document specifies
the details for each operation, including the HTTP method that is used, request parameters, the
data included in the request body, and the structure of the response body.
For more information about the OpenAPI specification, see OpenAPI Specification.
When you create a custom extension, you import an OpenAPI document that describes the REST
API of an external service. Watson Assistant parses the OpenAPI document to identify the
operations that are supported by the external service, along with information about the input
parameters and response for each operation and supported authentication methods.
After this processing is completed, the custom extension becomes available as a new integration
that you can connect to the assistant in the draft or live environment. Your assistant can then use
the extension to send requests to the external service based on conversations with your
customers. Values that are included in the response from the service are then mapped to action
variables, which can be accessed by subsequent action steps.
For more information about connecting a custom extension to an assistant, see Adding an
extension to your assistant at
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-add-custom-extension

© Copyright IBM Corp. 2018, 2022 14-25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty
References:
OpenAPI Specification
https://swagger.io/specification/
Watson Assistant Extensions Starter Kit
https://github.com/watson-developer-cloud/assistant-toolkit/tree/master/integrations/extensio
ns#watson-assistant-extensions-starter-kit
Building a custom extension
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-build-custom-extension
Adding an extension to your assistant
https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-add-custom-extension

© Copyright IBM Corp. 2018, 2022 14-26


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Adding custom extensions to Watson Assistant


• After you successfully import the OpenAPI document for the service that you plan to integrate
Watson Assistant with, it appears under Integrations > Extensions

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-21. Adding custom extensions to Watson Assistant

After you successfully import the OpenAPI document for the service that you plan to integrate
Watson Assistant with, it appears under Integrations > Extension.
In the example in the slide, the custom extension is called Weather details.
Click Add + to review the configuration and decide which variables of the responses you are going
to include. Now you are ready to use the extension from the steps in the Action.

© Copyright IBM Corp. 2018, 2022 14-27


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Using extensions from Action steps: Extension setup


• After you add the custom extension, you can use it to call the REST APIs that are defined in
this extension.
• In the And then setting of the step, you can specify which extension API to use and the
parameters to pass to it.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-22. Using extensions from Action steps: Extension setup

After you add the custom extension, you can use it to call the REST APIs that are defined in the
extension’s OpenAPI document. In this example, the custom extension is called “Weather
details”. It contains multiple operations (REST APIs) but the example shows only the
configuration for the “Location” API. The location API takes an input parameter called “woeid”
(Where-On-Earth-ID) and returns a location's 5-day weather forecast.

© Copyright IBM Corp. 2018, 2022 14-28


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Using extensions from Action steps: API response


• In the next Action step, you find the list of variables in the
response that you can use to form a reply to the user through the
Assistant says setting.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-23. Using extensions from Action steps: API response

After you call the REST API in an Action step, you create another step to use the response of this
API. The response variables are in the body object. In this example, the variables are body.time,
body.title, body.sun_set, body.sun-rise, body.latt_long.
You use these variables to form a reply as shown in the chat screen in the slide.
Reference:
MetaWeather Custom Extension
https://github.com/watson-developer-cloud/assistant-toolkit/tree/master/integrations/extensio
ns/starter-kits/metaweather

© Copyright IBM Corp. 2018, 2022 14-29


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty
14.3.Building a cognitive chatbot banking app:
Integrating Watson Assistant, Watson
Discovery, Natural Language
Understanding, and back-end banking
services

© Copyright IBM Corp. 2018, 2022 14-30


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Building a cognitive
chatbot banking app:
Integrating Watson
Assistant, Watson
Discovery, Natural
Language
Understanding, and
back-end banking
services
Cognitive banking chatbot application example

Figure 14-24. Building a cognitive chatbot banking app: Integrating Watson Assistant, Watson Discovery, Natural
Language Understanding, and back-end banking services

This section describes the integration flow that is implemented by the cognitive banking chatbot
application. This flow is a practical example of integrating multiple Watson services, an
application that orchestrates the services integration, and back-end banking systems.

© Copyright IBM Corp. 2018, 2022 14-31


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Integration example: Cognitive banking chatbot


• The cognitive banking chatbot demonstrates how the Watson Assistant dialog is enhanced by
integrating with the following services:
ƒ Natural Language Understanding to identify entities.
ƒ Discovery to retrieve answers from a collection of FAQ documents.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-25. Integration example: Cognitive banking chatbot

The cognitive banking chatbot provides an example of integration of multiple Watson services.
The Watson Assistant dialog is enhanced by adding capabilities that are provided by other Watson
APIs:
• Natural Language Understanding to identify entities
• Discovery to retrieve answers from a collection of FAQ documents

© Copyright IBM Corp. 2018, 2022 14-32


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Cognitive banking chatbot integration flow

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-26. Cognitive banking chatbot integration flow

Cognitive banking chatbot integration flow:


1. The FAQ documents are added to the Discovery collection.
2. The user interacts with a chatbot through the application UI.
3. The user input is processed with Natural Language Understanding. The context is enriched
with Natural Language Understanding-detected entities and keywords, for example, a
location.
4. The input and enriched context is sent to Assistant. Assistant recognizes intent, entities, and
dialog paths. It responds with a reply or action.
5. Optionally, a requested action is performed by the application, which might include one of the
following items:
a. Look up additional information from bank services to append to the reply.
b. Use Discovery to reply with an answer from the FAQ documents.

© Copyright IBM Corp. 2018, 2022 14-33


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty
14.4.Building an intelligent procurement system
by integrating Knowledge Studio and
Watson Discovery

© Copyright IBM Corp. 2018, 2022 14-34


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Building an intelligent
procurement system
by integrating
Knowledge Studio
and Watson Discovery

Intelligent procurement system example

Figure 14-27. Building an intelligent procurement system by integrating Knowledge Studio and Watson Discovery

This section describes the flow to build an intelligent procurement system by integrating Watson
Knowledge Studio and Watson Discovery.

© Copyright IBM Corp. 2018, 2022 14-35


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Intelligent procurement system


• The intelligent procurement system demonstrates how to use Watson Knowledge Studio and
Watson Discovery to enhance the analysis of shipping and procurement information.
• Instead of hiring experts to analyze the reports that are captured from data sources, this
solution provides expert analysis that is based on Watson Knowledge Studio and Discovery.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-28. Intelligent procurement system

Currently, customers perform analyses of various market reports on their own or hire experts to
make procurement decisions. These experts analyze reports that are captured from data sources,
a process that can be time-consuming and prone to human error, which potentially might cause a
chain effect of issues that can impact production. This code pattern explains how to create a
complete end-to-end solution for a procurement use case. With this intelligent procurement
system, which is based on Watson Knowledge Studio (WKS) and Watson Discovery, a customer
can receive expert analysis more quickly and accurately.

© Copyright IBM Corp. 2018, 2022 14-36


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Intelligent procurement system integration flow

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-29. Intelligent procurement system integration flow

Intelligent procurement system integration flow:


1. Load the type system and corpus files into Watson Knowledge Studio.
2. A user generates a model by training and evaluating data.
3. The Knowledge Studio model is deployed to Watson Discovery.
4. An application queries Watson Discovery for procurement data.
5. A user uses the app to select a query to perform, which retrieves the data from Watson
Discovery.

© Copyright IBM Corp. 2018, 2022 14-37


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty
14.5.Building a movie recommender solution
with Watson Assistant, Watson Studio,
Machine Learning, Db2, and Node-RED

© Copyright IBM Corp. 2018, 2022 14-38


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Building a movie
recommender
solution with
Watson Assistant,
Watson Studio,
Machine Learning,
Db2, and Node-RED

Figure 14-30. Building a movie recommender solution with Watson Assistant, Watson Studio, Machine Learning, Db2,
and Node-RED

This section describes the flow to build a movie recommender system by integrating Watson
Assistant, Watson Studio, Machine Learning, IBM Db2 database and by using Node-RED flows.

© Copyright IBM Corp. 2018, 2022 14-39


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Movie recommender system


• Today, recommender systems are widely used in various industries such as video streaming
services, online shopping, and content creation and sharing.
• Thanks to the development of deep learning and artificial intelligence (AI), recommender
systems can use the large amount of data that is generated by users' everyday selections and
make high-quality recommendations.
• Because collaborative filtering makes recommendations based on similar users, the more user
feedback and purchase data you have, the more accurate recommendations the machine
learning model can make.
• Learning objectives:
ƒ Train and deploy a neural collaborative filtering model for movie recommendations by using Watson
Studio
ƒ Build a virtual assistant as the user interface by using Watson Assistant.
ƒ Integrate the deployed model, Db2 database, and the virtual assistant by using Node-RED.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-31. Movie recommender system

Today, recommender systems are widely used in various industries such as video streaming
services, online shopping, and content creation and sharing. Thanks to the development of deep
learning and artificial intelligence (AI), recommender systems can use the large amount of data
that is generated by users' everyday selections and make high-quality recommendations.
If your organization has user purchase history and ratings data, you can use that data to
recommend new products to users. The user is more likely to buy the products you recommend
based on this data.
You can build and deploy a working system that uses IBM Cloud Pak for Data.
This presentation and Exercise 12. “Building a chatbot and movie recommender solution with
Watson services and Node-RED” guide you to build a movie recommender system with a simple
virtual assistant user interface. Train, deploy, and integrate a model by using IBM Watson Studio,
a Db2 database, IBM Watson Assistant, and Node-RED.
The learning objectives of this use case are:
• Train and deploy a neural collaborative filtering model for movie recommendations by using
Watson Studio
• Build a virtual assistant as the user interface by using Watson Assistant.
• Integrate the deployed model, Db2 database, and the virtual assistant by using Node-RED.
Reference:
Build a low-code chatbot and movie recommender solution using Watson Services and Node-RED
https://developer.ibm.com/tutorials/build-a-low-code-chatbot-and-movie-recommender-solutio
n-using-watson-services-and-node-red/

© Copyright IBM Corp. 2018, 2022 14-40


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Movie recommender integration architecture

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-32. Movie recommender integration architecture

Movie recommender integration flow:


1. The user asks the chatbot (Watson Assistant) for movie recommendations to watch.
2. The Watson Assistant sends the request to Node-RED.
3. Node-RED pulls the data from the Db2 database (random set of movies)
4. Node-RED queries the deployed machine learning model to predict the current user rating for
this set of movies.
5. Node-RED returns the top 10 recommended movies to the assistant.
6. The chatbot shows the result to user.
7. Overtime more user rating data is collected. Then, the model is retrained with the newly
collected data by using Watson Studio and it is deployed to Machine Learning Service. This
approach improves the accuracy of the predictions for user’s ratings.
Reference:
https://developer.ibm.com/tutorials/build-a-low-code-chatbot-and-movie-recommender-solutio
n-using-watson-services-and-node-red/

© Copyright IBM Corp. 2018, 2022 14-41


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Watson Assistant and Node-RED integration


• The integration between Watson Assistant and Node-RED is based on webhook.
• When the user asks about movie recommendation, the assistant prompts the user for the
user_id.
• Then, the assistant sends a POST request to the Node-RED flow.
• The node-RED flow runs and replies to the POST request with the recommended movie list.
• Finally, the assistant shows the recommended list to the user.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-33. Watson Assistant and Node-RED integration

Remember, a webhook is a mechanism that allows you to call out to an external program, in this
case it is the Node-RED flow. It consists of a POST request that has the user_id as a body.
After the Node-RED flow runs and interfaces with all the other solution components, it provides
the response to Watson Assistant. Then, the assistant shows the recommendation to the user.

© Copyright IBM Corp. 2018, 2022 14-42


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Node-RED and DB2 integration


• The Db2 database is loaded with a large set of movies.
• Node-RED queries the database for a random number of movies.
• Node-RED uses the random set of movies that is returned by Db2 to query the ML model.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-34. Node-RED and DB2 integration

One of the following two methods can be used to implement this integration in Node-RED: You
can use the Node-RED Db2 node to connect to the Db2 service instance.
• You can use the Node-RED http nodes to connect to the Db2 REST API interface.
The second method is more portable, and it can work in all types of Node-RED deployments, but it
is a bit more complex to implement. The Db2 REST API interface is used in this course.

© Copyright IBM Corp. 2018, 2022 14-43


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Node-RED and Machine Learning service integration


• After Node-RED gets the random list of movies from Db2, it prepares an HTTP POST request
and sends the request to the recommender model, which is deployed on the Machine
Learning service.
• The model predicts the user’s ratings for this list of movies and replies to Node-RED.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-35. Node-RED and Machine Learning service integration

The movie recommender model is deployed and running on your Machine Learning service. The
Machine Learning service exposes the prediction REST API. Node-RED prepares the body of the
request with the list of the random movie's IDs and the current user ID, then it sends the request.
The model predicts the user’s ratings to this list and replies to Node-RED.

© Copyright IBM Corp. 2018, 2022 14-44


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Machine Learning and Watson Studio integration


• Watson Studio builds and train the model.
• After the model is evaluated and shows acceptable accuracy, Watson Studio deploys it to the
Machine Learning service.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-36. Machine Learning and Watson Studio integration

Watson Studio builds, trains, and evaluates the model performance through the Jupyter
notebook. After the model shows acceptable performance, it is redeployed to the Machine
Learning service by using Watson Studio.
Overtime more user rating data is collected. Then, the model is retrained with the newly collected
data by using Watson Studio and it is deployed to Machine Learning Service. This approach
improves the accuracy of the predictions for user’s ratings.

© Copyright IBM Corp. 2018, 2022 14-45


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Unit summary • Explain the need to integrate multiple IBM Watson services to build
an intelligent solution.
• Describe the general flows for the integration of IBM Watson
Assistant with other services and applications.
• Explain the key capabilities that enable Watson Assistant
integration.
• Describe the flow to build a cognitive chatbot banking application by
integrating Watson Assistant, Watson Discovery, Watson Natural
Language Understanding, and back-end banking services.
• Describe the flow to build an intelligent procurement system by
integrating Watson Knowledge Studio and Watson Discovery.
• Describe the flow to build a movie recommender system by
integrating Watson Assistant, Watson Studio, Machine Learning, IBM
Db2 database and by using Node-RED flows.

© Copyright IBM Corporation 2018, 2022

Figure 14-37. Unit summary

© Copyright IBM Corp. 2018, 2022 14-46


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Review questions
1. True or False: It is better to integrate just one Watson service to add cognition to the
application.
2. True or False:
Integrating a custom model created for a particular domain by using Knowledge Studio with
Discovery service enables organizations to get expert analysis of their document collections.
3. To integrate your assistant with an external service that has a REST API, you can build a
custom extension by importing ____
a. OpenAPI document.
b. SOAP XML document.
c. Service XML definition.
d. Any JSON object.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-38. Review questions

© Copyright IBM Corp. 2018, 2022 14-47


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Review questions (cont.)


4. True or False: Retrieving answers from a collection of FAQ documents is a typical use case
for integrating Watson Assistant with Watson Discovery.
5. True or False: The intents, entities, output, and context objects in the response data that is
returned by the Watson Assistant's message API are set manually by the user.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-39. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 14-48


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Review answers
1. True or False: It is better to integrate just one Watson service to add cognition to the
application.

2. True or False: Integrating a custom model created for a particular domain by using Knowledge
Studio with Discovery service enables organizations to get expert analysis of their document
collections.
3. To integrate your assistant with an external service that has a REST API, you can build a
custom extension by importing ____
a. OpenAPI document.
b. SOAP XML document.
c. Service XML definition.
d. Any JSON object.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-40. Review answers

© Copyright IBM Corp. 2018, 2022 14-49


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Review answers (cont.)


4. True or False: Retrieving answers from a collection of FAQ documents is a typical use case for integrating
Watson Assistant with Watson Discovery.

5. True or False: The intents, entities, output, and context objects in the response data that is
returned by the Watson Assistant's message API are set manually by the user.

Designing and building an intelligent solution © Copyright IBM Corporation 2018, 2022

Figure 14-41. Review answers (cont.)

© Copyright IBM Corp. 2018, 2022 14-50


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty
Exercise: Building a chatbot and movie recommender
solution with Watson services and Node-RED

Figure 14-42. Exercise: Building a chatbot and movie recommender solution with Watson services and Node-RED

© Copyright IBM Corp. 2018, 2022 14-51


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 14. Designing and building an intelligent solution

Uempty

Exercise • This exercise introduces you to movie recommender solutions. In


this application you integrate Watson Assistant, Watson Studio and
objectives Machine Learning to build movie recommender system
• After completing this exercise, you should be able to:
ƒ Train and deploy a neural collaborative filtering model for movie
recommendations by using Watson Studio.
ƒ Build a virtual assistant as the user interface by using Watson Assistant.
ƒ Integrate the deployed model, Db2 database, and the virtual assistant by
using Node-RED.

© Copyright IBM Corporation 2018, 2022

Figure 14-43. Exercise objectives

© Copyright IBM Corp. 2018, 2022 14-52


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Unit 15.Getting started with AI ethics


Estimated time
01:30

Overview
Artificial intelligence is a major factor in people’s lives. It influences who gets a loan, how
companies hire and compensate employees, how customers are treated, even where
infrastructure and aid are allocated. Companies around the world are realizing that building trust
in AI is key to widespread adoption of the technology.
This unit explains AI ethics and trusted AI. It describes the principles that major AI vendors are
applying when they develop, implement, and deploy AI technologies.
This unit provides an overview of Watson OpenScale and explains how fairness is configured and
monitored by Watson OpenScale. This unit also describes how Watson OpenScale explains
decisions that are made by ML models.

© Copyright IBM Corp. 2018, 2022 15-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Unit objectives • Explain AI ethics and trusted AI


• List IBM’s principles for trust and transparency.
• List IBM’s pillars of trust.
• Describe each IBM pillar of trust.
• Describe the “trustworthy AI toolkits” donated by IBM to the Linux
Foundation.
• Describe the steps and the corresponding tools and resources that
are defined and provided by TensorFlow.
• Describe Microsoft responsible AI principles and toolbox.
• Provide an overview of Watson OpenScale.
• Explain how fairness is configured and monitored by Watson
OpenScale.
• Describe how Watson OpenScale explains decisions that are made
by ML models.

© Copyright IBM Corporation 2018, 2022

Figure 15-1. Unit objectives

© Copyright IBM Corp. 2018, 2022 15-2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Topics • Introduction to AI ethics


• Intoduction to Watson OpenScale
• Monitoring fairness in ML models with OpenScale
• Explaining decisions made by ML models with OpenScale

© Copyright IBM Corporation 2018, 2022

Figure 15-2. Topics

© Copyright IBM Corp. 2018, 2022 15-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
15.1.Introduction to AI ethics

© Copyright IBM Corp. 2018, 2022 15-4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Introduction to AI
ethics

Figure 15-3. Introduction to AI ethics

© Copyright IBM Corp. 2018, 2022 15-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

AI ethics (trusted AI)


• AI is embedded in everyday life, business,
government, medicine and more.
• AI makes decisions that directly impact
millions of people's lives.
• Companies around the world are realizing
that building trust in AI and being able to
explain decisions made through AI
algorithms are crucial to the success of
their business and key to widespread
adoption of the technology.
• Only by embedding ethical principles into
AI applications and processes, systems
based on trust can be built.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-4. AI ethics (trusted AI)

• Artificial intelligence is a major factor in people’s lives. It influences who gets a loan, how
companies hire and compensate employees, how customers are treated, even where
infrastructure and aid are allocated.
• Companies around the world are realizing that building trust in AI is key to widespread
adoption of the technology. They know that trust in AI and being able to explain decisions
made through AI algorithms are crucial to the success of their business from a brand
perspective. According to the Global AI Adoption Index 2021, 86% of global IT professionals
agree that consumers are more likely to choose the services of a company that offers
transparency and an ethical framework on how its data and AI models are built, managed, and
used.
References:
Foundations of trustworthy AI: governed data and AI, AI ethics and an open diverse ecosystem
https://www.ibm.com/blogs/watson/2021/05/trustworthy-ai-foundations/
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study
AI Ethics
https://www.ibm.com/artificial-intelligence/ethics
What is AI Ethics?
https://www.youtube.com/watch?v=aGwYtUzMQUk
Global Data from IBM Points to AI Growth as Businesses Strive for Resilience
https://newsroom.ibm.com/IBMs-Global-AI-Adoption-Index-2021

© Copyright IBM Corp. 2018, 2022 15-6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

IBM’s principles for trust and transparency


The purpose of AI is to augment The goal of AI is to make humans better at
their jobs. AI should benefit the many, not
human intelligence just the elite few.

Data and insights belong to their Clients own the data even when it is on
IBM’s servers or has been processed
creator through IBM AI. Data and insights belong to
the client.

Technology must be transparent and AI systems must work in ways that make
sense to the people that use them. It must
explainable be clear who trains the AI systems, what
data is used in training and most
importantly, what goes into the algorithms’
recommendations.
Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-5. IBM’s principles for trust and transparency

IBM chooses three Principles for Trust and Transparency. With them, IBM seeks to earn the trust
of its clients and society by being trustworthy. Trust is not only based on creating products that
can be understood, but also on maintaining appropriate relationships with data owners and other
people subject to AI, such as workers.
The purpose of AI is to augment human intelligence
AI is sometimes perceived as an adversary of human labor, automating tasks that are taken away
from people. By instead considering AI as a tool to help people fulfill their tasks, a more
harmonious relationship with AI is possible.
Data and insights belong to their creator
With this principle, IBM keeps data ownership where it belongs, with the people and organizations
from whom the data originated. Clients own the data even when it is on IBM’s servers or it is
processed through IBM AI. This data ownership principle has important ramifications for privacy,
security, government access, and cross-border data flow.
New technology, including AI systems, must be transparent and explainable
IBM seeks to maintain assurance that AI systems are working in ways that make sense to the
people that use them. The company should be clear about when AI is being used and what data is
involved in that AI (while maintaining client data ownerships and all that they entail). It should
address bias proactively, and generally seek to make AI understandable.

© Copyright IBM Corp. 2018, 2022 15-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
References:
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study
AI Ethics
https://www.ibm.com/artificial-intelligence/ethics
IBM’s Principles for Trust and Transparency
https://www.ibm.com/blogs/policy/trust-principles/

© Copyright IBM Corp. 2018, 2022 15-8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Foundational properties for AI ethics: The pillars of trust

Explainability Fairness Robustness Transparency Privacy


Understands how Properly As systems are Reinforces trust AI systems must
AI arrived at a calibrated, AI can employed to (the best way to prioritize and
conclusion. assist humans in make crucial promote it is safeguard
making fairer decisions, AI through consumers’
choices. must be secure disclosure). privacy and data
and robust. rights.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-6. Foundational properties for AI ethics: The pillars of trust

IBM’s pillars of trust help to implement the Principles of Trust and Transparency. Each pillar is a
well-established research subfield with dedicated communities. IBM Research published dozens
of papers in these fields and created open-source toolkits to bridge the gap between scientists
and practitioners to enable them to build trustworthy AI models. The pillars act as mid-level
principles that focus the larger picture of building AI trustworthiness into more precise
applications and ensure that operationalization is thorough and complete, all the way to the level
of code.
References:
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study
AI Ethics
https://www.ibm.com/artificial-intelligence/ethics
IBM’s Principles for Trust and Transparency
https://www.ibm.com/blogs/policy/trust-principles/

© Copyright IBM Corp. 2018, 2022 15-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Explainability
• AI-powered decisions should be
accompanied by the reasons and
explanations for the decisions.
• Focuses on the question of why an AI model
made a particular decision.
• Example: Explain why the AI application
decided to deny a loan.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-7. Explainability

While transparency offers a view into the AI technology and algorithms in use, simple and
straightforward explanations are needed for how AI is used.
People are entitled to understand how AI arrived at a conclusion, especially when those
conclusions impact decisions about their employability, their credit worthiness, or their potential.
Provided explanations need to be easy to understand.
References:
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study
Foundations of trustworthy AI: governed data and AI, AI ethics and an open diverse ecosystem
https://www.ibm.com/blogs/watson/2021/05/trustworthy-ai-foundations/

© Copyright IBM Corp. 2018, 2022 15-10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Fairness
• The reduction of human bias and the
equitable treatment of individuals and of
groups of individuals.
• Focuses on the issue of treating different
groups equally.
• Monitoring and safeguards are critical to
prevent bias from creeping into the solution.
• Example: Ensure that different genders
have similar loan approval rates in a training
data set or in the recommendations of an AI
model.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-8. Fairness

Fairness looks at the issue of treating different groups equally. For example, ensure that different
genders have similar loan approval rates in a training data set or in the recommendations of an AI
model.
References:
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study
Foundations of trustworthy AI: governed data and AI, AI ethics and an open diverse ecosystem
https://www.ibm.com/blogs/watson/2021/05/trustworthy-ai-foundations/

© Copyright IBM Corp. 2018, 2022 15-11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Robustness
• AI solution must be robust enough to handle
exceptional conditions effectively and to
minimize security risk.
• Robust systems can cope with attacks
without causing serious harm.
• AI must be able to withstand attacks and
maintain its integrity while under attack.
• Example: In evasion attacks, the adversary
crafts small changes to the original input to
an AI model to influence its behavior. This
approach can happen by making
imperceptible changes to the pixels of an
image of a cat, which might cause this image
to be misclassified as an ambulance.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-9. Robustness

AI systems must be resistant to attacks. Robust systems can cope with attacks without causing
serious harm. Particularly with AI, these systems can cope with adversarial attacks that are
directed in ways that target the weakness specific to AI systems.
References:
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study
Foundations of trustworthy AI: governed data and AI, AI ethics and an open diverse ecosystem
https://www.ibm.com/blogs/watson/2021/05/trustworthy-ai-foundations/
Adversarial Robustness 360 Toolbox v1.0: A Milestone in AI Security
https://www.ibm.com/blogs/research/2019/09/adversarial-robustness-360-toolbox-v1-0/

© Copyright IBM Corp. 2018, 2022 15-12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Transparency
• AI systems must be transparent.
• People need to be able to understand and
evaluate how the systems work and know
their strengths and weaknesses.
• Allows the AI technology to be easily
inspected. Transparency means that the
algorithms that are used in AI solutions are
not hidden or unable to be looked at more
closely.
• Example: AI applications allow developers
to collect and document facts about their
models to be fully transparent.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-10. Transparency

AI systems must be transparent to create trustworthy AI: people need to be able to understand
and evaluate how the systems work and know their strengths and weaknesses. Transparency
requires disclosure of relevant aspects of the systems.
References:
Foundations of trustworthy AI: governed data and AI, AI ethics and an open diverse ecosystem
https://www.ibm.com/blogs/watson/2021/05/trustworthy-ai-foundations/
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study

© Copyright IBM Corp. 2018, 2022 15-13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Privacy
• People deserve to have their sensitive data
protected.
• Only necessary data should be collected,
and consumers should have clear access to
controls over how their data is being used.
• Data belongs to the humans that create it,
and AI must ensure privacy with the highest
integrity.
• AI must ensure privacy at every turn, not
only of raw data, but of the insights gained
from that data.
• Example: AI applications notify people how
and when their data is being used, and what
it is being used for and by whom.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-11. Privacy

People deserve to have their sensitive data protected, which includes notifying people how and
when their data is being used, and what it is being used for and by whom. Only necessary data
should be collected, and consumers should have clear access to controls over how their data is
being used.
References:
Foundations of trustworthy AI: governed data and AI, AI ethics and an open diverse ecosystem
https://www.ibm.com/blogs/watson/2021/05/trustworthy-ai-foundations/
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study

© Copyright IBM Corp. 2018, 2022 15-14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Trustworthy AI toolkits - AI Explainability 360 toolkit


• Supports the explainability pillar
• The toolkit has eight algorithms
for making machine learning (ML)
models more transparent and
comprehensible, including a demo
to help understand how various
users require different
explanations.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-12. Trustworthy AI toolkits - AI Explainability 360 toolkit

Trustworthy AI is a term that is used to describe AI that is lawful, ethically adherent, and
technically robust. It is based on the idea that AI reaches its full potential when trust can be
established in each stage of its lifecycle, from design to development, deployment, and use. See
“What is Trustworthy AI” at
https://www.onespan.com/blog/trustworthy-ai-why-we-need-it-and-how-achieve-it#:~:text=Tr
ustworthy%20AI%20is%20a%20term,to%20development%2C%20deployment%20and%20us
e
In 2020, IBM donated a set of AI toolkits to the Linux Foundation, including AI Explainability 360,
AI Fairness 360, the Adversarial Robustness 360 toolbox. IBM also open-sourced AI FactSheets
360 and Uncertainty Quantification 360 toolkits. These toolkits facilitate collaboration among
researchers, practitioners, and the multidiscipline trustworthy AI community.
The AI Explainability 360 toolkit supports IBM’s commitment to explainability, the first pillar of
trust. This extensible open-source toolkit can help you comprehend how machine learning
models predict labels by various means throughout the AI application lifecycle.
This toolkit has eight algorithms for making machine learning (ML) models more transparent and
comprehensible. It includes a demo to help understand how various users require different
explanations. Making such models comprehensible is vital to also making them trustworthy. After
all, if models work most of the time, but occasionally fail inexplicably, people are unlikely to place
their trust in the model, especially if those failures create a risk of harm.

© Copyright IBM Corp. 2018, 2022 15-15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
References:
Foundations of trustworthy AI: governed data and AI, AI ethics and an open diverse ecosystem
https://www.ibm.com/blogs/watson/2021/05/trustworthy-ai-foundations/
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study
AI Ethics
https://www.ibm.com/artificial-intelligence/ethics
The AI 360 Toolkit: AI models explained
https://developer.ibm.com/articles/the-ai-360-toolkit-ai-models-explained/?mhsrc=ibmsearch_
a&mhq=Trustworthy%20AI
Foundations of trustworthy AI: governed data and AI, AI ethics and an open diverse ecosystem
https://www.ibm.com/blogs/watson/2021/05/trustworthy-ai-foundations/
AI Explainability 360
https://aix360.mybluemix.net/
AI Explainability 360 – Demo
https://aix360.mybluemix.net/consumer

© Copyright IBM Corp. 2018, 2022 15-16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Trustworthy AI toolkits – AI Fairness 360 toolkit


• Supports the fairness pillar
• The toolkit includes more than
70 fairness metrics and 10 bias
mitigation algorithms for
enhancing fairness in ML.
• Contains metrics for assessing
whether individuals and groups
are treated fairly in the
implementation of AI.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-13. Trustworthy AI toolkits – AI Fairness 360 toolkit

The AI Fairness 360 toolkit supports the fairness pillar. The toolkit includes more than 70 fairness
metrics and 10 bias mitigation algorithms for enhancing fairness in ML. This toolkit contains
metrics for assessing whether individuals and groups are treated fairly in the implementation of
AI.
References:
The AI 360 Toolkit: AI models explained
https://developer.ibm.com/articles/the-ai-360-toolkit-ai-models-explained/?mhsrc=ibmsearch_
a&mhq=Trustworthy%20AI
Foundations of trustworthy AI: governed data and AI, AI ethics and an open diverse ecosystem
https://www.ibm.com/blogs/watson/2021/05/trustworthy-ai-foundations/
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study
AI Ethics
https://www.ibm.com/artificial-intelligence/ethics
AI fairness 360
https://aif360.mybluemix.net/
AI Fairness 360 – Demo
https://aif360.mybluemix.net/data

© Copyright IBM Corp. 2018, 2022 15-17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Trustworthy AI toolkits - Adversarial Robustness 360 toolbox


• Supports the robustness pillar
• The tools in the toolbox allow
ML developers to defend
against adversarial attacks,
such as poisoning, inference,
extraction, and evasion.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-14. Trustworthy AI toolkits - Adversarial Robustness 360 toolbox

The Adversarial Robustness 360 toolbox supports IBM’s commitment to robustness, its third
pillar of trust. The tools available allow ML developers to defend against adversarial attacks, such
as poisoning, inference, extraction, and evasion. The toolbox includes a demo to create and
replicate attacks and defense methods for ML models. Developers can evaluate how their models
will do when subjected to such attacks to adjust the models and make them more robust.
References:
The AI 360 Toolkit: AI models explained
https://developer.ibm.com/articles/the-ai-360-toolkit-ai-models-explained/?mhsrc=ibmsearch_
a&mhq=Trustworthy%20AI
Foundations of trustworthy AI: governed data and AI, AI ethics and an open diverse ecosystem
https://www.ibm.com/blogs/watson/2021/05/trustworthy-ai-foundations/
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study
AI Ethics
https://www.ibm.com/artificial-intelligence/ethics
Your AI model might be telling you this is not a cat
https://art-demo.mybluemix.net/

© Copyright IBM Corp. 2018, 2022 15-18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Trustworthy AI toolkits – AI FactSheets 360 tool


• Supports the transparency pillar.
• The toolkit has several examples of
FactSheets.
ƒ Collections of facts about an AI model.
ƒ Information that is collected by these
sheets is useful to understand the
model and enable its governance.
• Facts include:
ƒ The purpose of the model
ƒ Characteristics of the data set
ƒ Various relevant aspects of the creation
or deployment of the model or service.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-15. Trustworthy AI toolkits – AI FactSheets 360 tool

AI FactSheets 360 tool supports the transparency pillar. Factsheets are collections of facts about
an AI model. The tool has several examples of FactSheets and a methodology for creating them.
The information that is collected by these sheets is useful for understanding the model and
enabling its governance. Facts include the purpose of the model, characteristics of the data set
and various relevant aspects of the creation or deployment of the model or service.
References:
Foundations of trustworthy AI: governed data and AI, AI ethics and an open diverse ecosystem
https://www.ibm.com/blogs/watson/2021/05/trustworthy-ai-foundations/
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study
AI Ethics
https://www.ibm.com/artificial-intelligence/ethics
AI FactSheets 360
https://aifs360.mybluemix.net/

© Copyright IBM Corp. 2018, 2022 15-19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Trustworthy AI toolkits – Uncertainty Quantification 360 toolkit


• Supports the robustness and explainability
pillars
• The toolkit reveals the importance of
intellectual humility and helps to prevent
overconfidence in AI systems by clearly
indicating their capabilities and limitations.
• Develops a better understanding of the
reliability of AI judgments in particular
situations.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-16. Trustworthy AI toolkits – Uncertainty Quantification 360 toolkit

The Uncertainty Quantification 360 toolkit, which includes a demo, supports several of IBM’s
pillars of trust, especially robustness and explainability. By developing a better understanding of
the reliability of AI judgments in particular situations, uncertainty quantification reveals the
importance of intellectual humility and helps to prevent overconfidence in AI systems by clearly
indicating their capabilities and limitations.
References:
The AI 360 Toolkit: AI models explained
https://developer.ibm.com/articles/the-ai-360-toolkit-ai-models-explained/?mhsrc=ibmsearch_
a&mhq=Trustworthy%20AI
Foundations of trustworthy AI: governed data and AI, AI ethics and an open diverse ecosystem
https://www.ibm.com/blogs/watson/2021/05/trustworthy-ai-foundations/
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study
AI Ethics
https://www.ibm.com/artificial-intelligence/ethics
Uncertainty Quantification 360
http://uq360.mybluemix.net/
Demo: House Price Prediction Model
http://uq360.mybluemix.net/demo/2/choose

© Copyright IBM Corp. 2018, 2022 15-20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

IBM Cloud Pak for Data and trustworthy AI

Access the right data, just in time,


regardless of where it is stored. Use
Build trust in data data fabric across a hybrid cloud
landscape.

Shorten the time to model production,


Build trust in models ensure lifecycle managing, monitoring
and retraining by using automation.

Drive consistent, transparent and


repeatable AI governance, managing
Build trust in processes risk and compliance across the AI
lifecycle.
Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-17. IBM Cloud Pak for Data and trustworthy AI

IBM Cloud Pak for Data is a consolidated set of proprietary tools for use in the entire data
analytics lifecycles. It allows all users from an enterprise, for example business users, data
scientists, and ML operations to collaborate on the same toolset to collect, organize, and analyze
data. AI insights require the right data, automated modeling tools, and governance to ensure
transparency and trust. Automated data orchestration, model building, deploying, and
governance can reduce risks and help drive accuracy, accountability, and responsible AI.
IBM Cloud Pak for Data includes tools that provide the following capabilities:
Build trust in data
Access the right data, just in time, regardless of where it is stored. Use data fabric across a hybrid
cloud landscape.
Build trust in models??
Shorten the time to model production, ensure lifecycle managing, monitoring, and retraining by
using automation.
Build trust in processes?
Drive consistent, transparent, and repeatable AI governance, managing risk and compliance
across the AI lifecycle.
References:
MLOps and Trustworthy AI?
https://www.ibm.com/products/cloud-pak-for-data/scale-trustworthy-ai
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study

© Copyright IBM Corp. 2018, 2022 15-21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Responsible AI tools for TensorFlow


ML workflow step Tools and resources
1. Define problem • People + AI Guidebook
Design models with Responsible AI in mind. • Pair Explorables
2. Construct and prepare data • Know Your Data
Examine data for potential biases. • TensorFlow Data Validation
• Data Cards
• Monk skin Tone Scale
3. Build and train model • TensorFlow Model Remediation
Train models by using privacy-preserving, interpretable techniques. • TensorFlow Privacy
• TensorFlow Federated
• TensorFlow Constrained Optimization (TFCO)
• TensorFlow Lattice (TFL)
4. Evaluate model • Fairness Indicators
Debug, evaluate, and visualize model performance . • TensorFlow Model Analysis
• What-If Tool
• Language Interpretability Tool (LIT)
• Explainable AI
• TensorFlow Privacy Tests
• TensorBoard
5. Deploy and monitor • Model Card Toolkit
Track and communicate about model context and details • ML Metadata
• Model Cards
Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-18. Responsible AI tools for TensorFlow

TensoFlow helps to make progress in the responsible development of AI by sharing a collection of


resources and tools with the ML community.
In 2018, Google introduced its AI Principles, which guide the ethical development and use of AI in
research and products. The TensorFlow team works to provide developers with tools and
techniques to adhere to Responsible AI (RAI) practices.
Responsible AI practices can be incorporated at every step of the ML workflow. TensorFlow
defines the following steps and the corresponding tools and resources for each step.
Step 1. Define the problem
Use the following resources to design models with Responsible AI in mind
• People + AI Guidebook at https://pair.withgoogle.com/guidebook/
• Pair Explorables at https://pair.withgoogle.com/explorables/
Step 2. Construct and prepare data
Use the following tools to examine data for potential biases.
• Know Your Data at https://knowyourdata.withgoogle.com/
• TensorFlow Data Validation at https://www.tensorflow.org/tfx/guide/tfdv
• Data Cards at
https://research.google/static/documents/datasets/crowdsourced-high-quality-colombian-s
panish-es-co-multi-speaker-speech-dataset.pdf
• Monk skin Tone Scale at https://www.skintone.google/

© Copyright IBM Corp. 2018, 2022 15-22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
Step 3. Build and train model
Use the following tools to train models by using privacy-preserving, interpretable techniques, and
more.
• TensorFlow Model Remediation at
https://www.tensorflow.org/responsible_ai/model_remediation
• TensorFlow Privacy at https://www.tensorflow.org/responsible_ai/privacy/guide
• TensorFlow Federated at https://www.tensorflow.org/federated
• TensorFlow Constrained Optimization (TFCO) at
https://github.com/google-research/tensorflow_constrained_optimization/blob/master/REA
DME.md
• TensorFlow Lattice (TFL) at https://www.tensorflow.org/lattice/overview
Step 4. Evaluate model
Debug, evaluate, and visualize model performance using the following tools:
• Fairness Indicators at https://www.tensorflow.org/responsible_ai/fairness_indicators/guide
• TensorFlow Model Analysis at https://www.tensorflow.org/tfx/model_analysis/install
• What-If Tool at https://pair-code.github.io/what-if-tool/
• Language Interpretability Tool (LIT) at https://pair-code.github.io/lit/
• Explainable AI at https://cloud.google.com/explainable-ai
• TensorFlow Privacy Tests at
https://blog.tensorflow.org/2020/06/introducing-new-privacy-testing-library.html
• TensorBoard at https://www.tensorflow.org/tensorboard/get_started
Step 5. Deploy and monitor
Use the following tools to track and communicate about model context and details.
• Model Card Toolkit at https://www.tensorflow.org/responsible_ai/model_card_toolkit/guide
• ML Metadata at https://www.tensorflow.org/tfx/guide/mlmd
• Model Cards at https://modelcards.withgoogle.com/about
Reference:
Responsible AI tools and resources for TensorFlow
https://www.tensorflow.org/responsible_ai

© Copyright IBM Corp. 2018, 2022 15-23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Microsoft responsible AI principles

Reliability
Fairness Inclusiveness
& Safety

Privacy
Accountability Transparency
& Security

• Responsible AI
ƒ Approach to assessing, developing, and deploying AI systems in a safe, trustworthy, and ethical
manner.
ƒ Aims at making sure that Microsoft principles are applied when designing, developing, and deploying
technology and it is inclusive and accessible for all people.
ƒ Detect bias, make the systems fair, detect errors and blind spots in the technologies, be always vigilant
in areas where technology can impose on privacy and human rights.
ƒ Responsibility is at the core.
Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-19. Microsoft responsible AI principles

According to Microsoft, responsible AI is an approach to assessing, developing, and deploying AI


systems in a safe, trustworthy, and ethical manner, and take responsible decisions and actions.
Responsible AI aims at making sure that Microsoft principles are applied when designing,
developing, and deploying technology and it is inclusive and accessible for all people. Detect bias,
make the systems more fair, detect errors and blind spots in the technologies, be always vigilant
in areas where technology can impose on privacy and human rights. Responsibility is at the core.
The Responsible AI principles from Microsoft are:
Fairness
Bias can affect results. Example: A loan-approval model discriminates by gender due to bias in the
data with which it as trained.
Reliability & Safety
Error might cause harm. Example: An autonomous vehicle experiences a system failure and
causes a collision.
Inclusiveness
Solutions might not work for everyone. Example: A predictive app provides no audio output for
visually impaired users.
Privacy & Security
Data might be exposed. Example: A medical diagnostic bot is trained by using sensitive patient
data, which is stored insecurely.

© Copyright IBM Corp. 2018, 2022 15-24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
Accountability
Who is liable for AI-driven decisions? Example: An innocent person is convicted of a crime based
on evidence form facial recognition, who’s responsible?
Transparency
Users must trust a complex system. Example: An AI-based financial tool makes investment
recommendations, what are they based on?
Reference:
Responsible AI
https://www.microsoft.com/en-us/ai/responsible-ai?activetab=pivot1%3aprimaryr6

© Copyright IBM Corp. 2018, 2022 15-25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Microsoft Responsible AI Toolbox

Dashboard Description
Responsible AI dashboard A single pane of glass brings together several mature Responsible
AI tools from the toolbox for a holistic responsible assessment and
debugging of models and to make informed business decisions.
With this dashboard, you can identify model errors, diagnose why
those errors are happening, and mitigate them.

Fairness dashboard Helps to understand model’s fairness issues by using various group-
fairness metrics across sensitive features and cohorts.
Error Analysis dashboard Helps to identify model errors and discover cohorts of data for
which the model underperforms.
Interpretability dashboard Helps to understand model predictions.

• HAX Toolkit
ƒ Tools for creating fluid and responsible human-AI experiences.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-20. Microsoft Responsible AI Toolbox

Responsible AI Toolbox is a suite of tools provides a collection of model and data exploration and
assessment user interfaces that enable a better understanding of AI systems. These interfaces
empower developers and stakeholders of AI systems to develop and monitor AI more responsibly
and take better data-driven actions.
The Toolbox consists of four dashboards:
Responsible AI dashboard, a single pane of glass bringing together several mature Responsible
AI tools from the toolbox for a holistic responsible assessment and debugging of models and
making informed business decisions. With this dashboard, you can identify model errors, diagnose
why those errors are happening, and mitigate them. Moreover, the causal decision-making
capabilities provide actionable insights to your stakeholders and customers.
Fairness dashboard, for understanding model’s fairness issues by using various group-fairness
metrics across sensitive features and cohorts. This dashboard is powered by Fairlearn.
Error Analysis dashboard, for identifying model errors and discovering cohorts of data for which
the model underperforms.
Interpretability dashboard, for understanding model predictions. This dashboard is powered by
InterpretML.
The Human-AI eXperience (HAX) Toolkit is a set of practical tools for creating human-AI
experiences with people in mind from the beginning. Each tool is designed to help AI creators,
including UX, AI, project management, and engineering teams, take this human-centered
approach in their day-to-day work.

© Copyright IBM Corp. 2018, 2022 15-26


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
References:
Responsible AI Resources
https://www.microsoft.com/en-us/ai/responsible-ai-resources
Responsible AI Toolbox
https://github.com/microsoft/responsible-ai-toolbox
Responsible AI dashboard
https://github.com/microsoft/responsible-ai-toolbox#introducing-responsible-ai-dashboard
Fairness dashboard
https://github.com/microsoft/responsible-ai-widgets/blob/main/docs/fairness-dashboard-READ
ME.md
Error Analysis dashboard
https://github.com/microsoft/responsible-ai-widgets/blob/main/docs/erroranalysis-dashboard-
README.md
HAX Toolkit
https://www.microsoft.com/en-us/haxtoolkit/

© Copyright IBM Corp. 2018, 2022 15-27


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
15.2.Intoduction to Watson OpenScale

© Copyright IBM Corp. 2018, 2022 15-28


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Intoduction to
Watson OpenScale

Figure 15-21. Intoduction to Watson OpenScale

© Copyright IBM Corp. 2018, 2022 15-29


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

What is Watson OpenScale


• A model risk management solution with
model evaluation.
ƒ Measures outcomes from AI models across its
lifecycle and performs model validations.
• Tracks and measures outcomes from your AI
models.
• Helps ensure that models remain fair,
explainable, and compliant.
• Detects and helps correct the drift in
accuracy when an AI model is in production.
• Monitors ML models for bias.
• Understands and provides explanations.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-22. What is Watson OpenScale

Watson OpenScale tracks and measures outcomes from your AI models, and helps ensure they
remain fair, explainable, and compliant wherever your models were built or are running. Watson
OpenScale also detects and helps correct the drift in accuracy when an AI model is in production.
Enterprises use model evaluation to automate and put into service AI lifecycle in business
applications. This approach ensures that AI models are free from bias, can be easily explained
and understood by business users, and are auditable in business transactions. Model evaluation
supports AI models built and run with the tools and model frameworks of your choice.
References:
Manage model risk
https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=SSQNUZ_4.0/wsj/model/icp4d-ri
sk-wos-only.html
Frequently asked questions for Watson OpenScale
https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=openscale-faqs#faq-whatsa
Validating and monitoring AI models with Watson OpenScale
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/getting-started.html
Responsible Use of Technology: The IBM Case Study
https://www.weforum.org/whitepapers/responsible-use-of-technology-the-ibm-case-study

© Copyright IBM Corp. 2018, 2022 15-30


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Components of Watson OpenScale


Watson OpenScale has four main areas:
• Insights: The Insights dashboard displays the models that you are monitoring and provides
status on the results of model evaluations.
• Explain a transaction: Explanations describe how the model determined a prediction. It lists
some of the most important factors that led to the predictions so you can be confident in the
process.
• Configuration: Use the Configuration tab to select a database, set up a machine learning
provider, and optionally add integrated services.
• Support: The Support tab provides you with resources to get the help you need with Watson
OpenScale. Access product documentation or connect with IBM Community on Stack
Overflow.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-23. Components of Watson OpenScale

Watson OpenScale has four main areas:


Insights: The Insights dashboard displays the models that you are monitoring and provides status
on the results of model evaluations.
Explain a transaction: Explanations describe how the model determined a prediction. It lists
some of the most important factors that led to the predictions so you can be confident in the
process.
Configuration: Use the Configuration tab to select a database, set up a machine learning provider,
and optionally add integrated services.
Support: The Support tab provides you with resources to get the help you need with Watson
OpenScale. Access product documentation or connect with IBM Community on Stack Overflow.
To create a service ticket with the IBM Support team, click Manage tickets.
Reference:
Components of Watson OpenScale
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/getting-started.html

© Copyright IBM Corp. 2018, 2022 15-31


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Monitors
• Monitors evaluate your deployments against specified metrics. Configure alerts that indicate
when a threshold is crossed for a given metric.
• Watson OpenScale evaluates your deployments based on three default monitors:
ƒ Quality describes the model’s ability to provide correct outcomes based on labeled test data called
Feedback data.
ƒ Fairness describes how evenly the model delivers favorable outcomes between groups. The Fairness
monitor looks for biased outcomes in your model.
ƒ Drift warns you of a drop in accuracy or data consistency.

ň Note ņņņņņņņņņņņņņņņņņ
You can also create Custom monitors for your deployment.
Ŋņņņņņņņņņņņņņņņņņņņņ

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-24. Monitors

Monitors evaluate your deployments against specified metrics. Configure alerts that indicate
when a threshold is crossed for a given metric. Watson OpenScale evaluates your deployments
based on three default monitors:
Quality describes the model’s ability to provide correct outcomes based on labeled test data
called Feedback data.
Fairness describes how evenly the model delivers favorable outcomes between groups. The
Fairness monitor looks for biased outcomes in your model.
Drift warns you of a drop in accuracy or data consistency.

Note

You can also create Custom monitors for your deployment.

Reference:
Monitors
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/getting-started.html

© Copyright IBM Corp. 2018, 2022 15-32


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Supported machine learning engines


• Watson OpenScale service supports the following machine learning engines.
• You can use the following frameworks to perform payload logging, feedback logging, and to
measure performance accuracy, runtime bias detection, explainability, and auto-debias
function as part of your model evaluation.
ƒ IBM Watson Machine Learning
ƒ Azure ML Studio
ƒ Azure ML Service
ƒ AWS SageMaker
ƒ Custom

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-25. Supported machine learning engines

Watson OpenScale service supports the following machine learning engines.


You can use the following frameworks to perform payload logging, feedback logging, and to
measure performance accuracy, runtime bias detection, explainability, and auto-debias function
as part of your model evaluation.
• IBM Watson Machine Learning
• Azure ML Studio
• Azure ML Service
• AWS SageMaker
• Custom

© Copyright IBM Corp. 2018, 2022 15-33


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
References:
Supported machine learning engines, frameworks, and models
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-frameworks-ovr.html?context
=cpdaas&audience=wdp
IBM Watson Machine Learning
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-frameworks-wml-cloud.html?
context=cpdaas&audience=wdp#frmwrks-wml
Azure ML Studio frameworks
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-frameworks-azure-ml-studio.
html?context=cpdaas&audience=wdp#frmwrks-azure
Azure ML Service frameworks
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-frameworks-azure-ml-
service.html?context=cpdaas&audience=wdp
AWS SageMaker
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-frameworks-aws-sagemaker.
html?context=cpdaas&audience=wdp#frmwrks-aws-sage
Custom ML frameworks
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-frameworks-custom.html?co
ntext=cpdaas&audience=wdp#frmwrks-custom

© Copyright IBM Corp. 2018, 2022 15-34


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
15.3.Monitoring fairness in ML models with
OpenScale

© Copyright IBM Corp. 2018, 2022 15-35


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Monitoring fairness
in ML models with
OpenScale

Figure 15-26. Monitoring fairness in ML models with OpenScale

© Copyright IBM Corp. 2018, 2022 15-36


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Fairness and bias in machine learning models


• Consider a pair of valid inputs which are close to each other.
ƒ Example: Female and Male.
• A model is individually biased (or unfair) if the pair of valid inputs are treated differently by the
model (different class label, or large difference in output).
ƒ Example: A model approves more loans for males than for females.
• A model is unbiased (or fair if the pair of valid inputs are treated equally to a certain threshold
by the model.
ƒ Example: A model approves loans equally to a certain threshold for both males and females.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-27. Fairness and bias in machine learning models

Recent breakthroughs in artificial intelligence, especially machine learning, led to AI-based


systems that assume a significant role in making real-world decisions. Examples include
decision-making systems for recidivism (the tendency of a convicted criminal to reoffend) risk
assessments, credit assessments (including loan risk), hiring decisions, content dissemination in
social media, and so on. Many of these systems are trained on, and then evaluate, structured data
that pertains to individuals (convicts, borrowers, job candidates, and so on). Unfortunately,
studies already showed that such systems might be prone to discriminating against users and
consumers based on characteristics such as race and gender.
Consider the problem of whether a given decision model, working with structured data, has
individual fairness.
A model is individually biased (or unfair) if there is a pair of valid inputs which are close to each
other (according to an appropriate metric) but are treated differently by the model (different class
label, or large difference in output).
A model is unbiased (or fair) if no such pair exists.
Reference:
Verifying individual fairness in machine learning models
https://research.ibm.com/publications/verifying-individual-fairness-in-machine-learning-models
Verifying Individual Fairness in Machine Learning Models
http://proceedings.mlr.press/v124/george-john20a/george-john20a.pdf

© Copyright IBM Corp. 2018, 2022 15-37


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Fairness monitor key concepts


• Features
ƒ The model attributes that are evaluated to detect bias, for example, Sex or Age.
• Reference and monitored groups
ƒ The values of the features are specified as either a reference or monitored group.
í The monitored group represents the values that are most at risk for biased outcomes. For example,
for the Sex feature, you can set Female and Non-binary as the monitored groups. For a numeric
feature, such as Age, you can set [18-25] as the monitored group.
í All other values for the feature are then considered as the reference group, for example, Sex=Male or
Age=[26,100].
• Fairness alert threshold
ƒ Specifies an acceptable difference between the percentage of favorable outcomes for the monitored
group and the percentage of favorable outcomes for the reference group. For example, if the
percentage of favorable outcomes for a group in your model is 70% and the fairness threshold is set to
80%, then the fairness monitor detects bias in your model.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-28. Fairness monitor key concepts

The fairness monitor evaluates your model for biases to ensure fair outcomes among different
groups.
Before you configure the fairness monitor, you must understand the following key concepts:
Features
The features are the model attributes that are evaluated to detect bias. For example, you can
configure the fairness monitor to evaluate features such as Sex or Age for bias. Only features that
are of categorical, numeric (integer), float, or double fairness data type are supported.
Reference and monitored groups
The values of the features are specified as either a reference or monitored group. The monitored
group represents the values that are most at risk for biased outcomes. For example, for the Sex
feature, you can set Female and Non-binary as the monitored groups. For a numeric feature, such
as Age, you can set [18-25] as the monitored group. All other values for the feature are then
considered as the reference group, for example, Sex=Male or Age=[26,100].
Fairness alert threshold
The fairness alert threshold specifies an acceptable difference between the percentage of
favorable outcomes for the monitored group and the percentage of favorable outcomes for the
reference group. For example, if the percentage of favorable outcomes for a group in your model
is 70% and the fairness threshold is set to 80%, then the fairness monitor detects bias in your
model.

© Copyright IBM Corp. 2018, 2022 15-38


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
Reference:
Configuring the fairness monitor
https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=monitoring-configuring-fairness-
monitor

© Copyright IBM Corp. 2018, 2022 15-39


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Fairness monitor key concepts (cont.)


• Minimum sample size
ƒ It is set to delay the fairness evaluation until a minimum number of records are available in the
evaluation data set. This function ensures that the sample size is not too small and skews results.
• Maximum sample size
ƒ By default, the maximum number of records that you can run is 1,000,000 records. You can change
this maximum number. If you increase the maximum number of records, make sure that you have the
processing power and resources to successfully run them.
• Favorable and unfavorable outcomes
ƒ The output of the model is categorized as either favorable or unfavorable. For example, if the model is
recommending whether a person gets a loan or not, then the favorable outcome might be Loan
Granted or Loan Partially Granted. The unfavorable outcome might be Loan Denied.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-29. Fairness monitor key concepts (cont.)

Minimum sample size


The minimum sample size is set to delay the fairness evaluation until a minimum number of
records are available in the evaluation data set. This function ensures that the sample size is not
too small and skews results. By setting a minimum sample size, you prevent measuring fairness
until a minimum number of records are available in the evaluation data set. Minimum sample size
ensures that the sample size is not too small to skew results. When the fairness monitor runs, it
uses the minimum sample size to decide the number of records that are evaluated.
Maximum sample size
By default, the maximum number of records that you can run is 1,000,000 records. You can
change this maximum number by adding the BIAS_CHECKING_RECORDS_MAX_LIMIT
environment variable to the deployment configuration. If you increase the maximum number of
records, make sure that you have the processing power and resources to successfully run them.
In the following example, the BIAS_CHECKING_RECORDS_MAX_LIMIT environment variable is
configured to set the maximum number of records to 1,200,000 records:
"BIAS_CHECKING_RECORDS_MAX_LIMIT": 1200000
Favorable and unfavorable outcomes
The output of the model is categorized as either favorable or unfavorable. For example, if the
model is recommending whether a person gets a loan or not, then the Favorable outcome might
be Loan Granted or Loan Partially Granted. The unfavorable outcome might be Loan Denied.
The values that represent a favorable outcome are derived from the label column in the training
data. By default the predictedLabel column is set as the prediction column. Favorable and
unfavorable values must be specified by using the value of the prediction column as a string data
type, such as 0 or 1 when you are uploading training data.

© Copyright IBM Corp. 2018, 2022 15-40


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
Reference:
Configuring the fairness monitor
https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=monitoring-configuring-fairness-
monitor

© Copyright IBM Corp. 2018, 2022 15-41


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Configuring the fairness monitor - Features

• Features are the model attributes that are


evaluated to detect bias.
• The monitored group represents the values that
are most at risk for biased outcomes.
• The reference group represents all other values.
• The fairness alert threshold specifies an
acceptable difference between:
ƒ The percentage of favorable outcomes for the
monitored group
ƒ The percentage of favorable outcomes for the
reference group.
• Example: If the percentage of favorable outcomes
for a group in your model is 85% and the fairness
threshold is set to 98%, then the fairness monitor
detects bias in your model.
Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-30. Configuring the fairness monitor - Features

For step instructions see, “Configuring the fairness monitor” > “Steps” at
https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=monitoring-configuring-fairness-
monitor
References:
Fairness metrics overview
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-fairness-ovr.html?context=cp
daas&audience=wdp
Configuring the fairness monitor
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-monitor-fairness.html?contex
t=cpdaas&audience=wdp

© Copyright IBM Corp. 2018, 2022 15-42


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Configuring the fairness monitor – Favorable outcome

• The output of the model is categorized as


either favorable or unfavorable.
• The favorable outcome is the outcome of
interest or the preferable outcome.
• Example: A model is recommending whether
a person gets a loan or not.
ƒ The favorable outcome: Loan Granted with no
risk.
ƒ The unfavorable outcome: Loan Denied with
risk.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-31. Configuring the fairness monitor – Favorable outcome

The output of the model is categorized as either favorable or unfavorable. For example, if the
model is recommending whether a person gets a loan or not, then the Favorable outcome might
be Loan Granted or Loan Partially Granted. The unfavorable outcome might be Loan Denied.
When you configure the IBM Watson OpenScale fairness monitor, you can generate a set of
metrics to evaluate the fairness of your model. You can use the fairness metrics to determine
whether your model produces biased outcomes.
References:
Favorable and unfavorable outcomes
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-monitor-fairness.html?contex
t=cpdaas&audience=wdp
Fairness metrics overview
https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=openscale-fairness-metrics-overv
iew

© Copyright IBM Corp. 2018, 2022 15-43


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Configuring the fairness monitor – Sample size

• The minimum sample size is set to delay the


fairness evaluation until a minimum number
of records are available in the evaluation data
set.
ƒ Ensures that the sample size is not too small
and skews results.
• Maximum sample size
ƒ By default, the maximum number of records
that you can run is 1,000,000 records.
ƒ You can change this maximum number by
addingthe BIAS_CHECKING_RECORDS_MAX_L
IMIT environment variable to the deployment
configuration.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-32. Configuring the fairness monitor – Sample size

Minimum sample size


The minimum sample size is set to delay the fairness evaluation until a minimum number of
records are available in the evaluation data set. This function ensures that the sample size is not
too small and skews results. By setting a minimum sample size, you prevent measuring fairness
until a minimum number of records are available in the evaluation data set. This ensures that the
sample size is not too small to skew results. When the fairness monitor runs, it uses the minimum
sample size to decide the number of records that are evaluated.
Maximum sample size
By default, the maximum number of records that you can run is 1,000,000 records. You can
change this maximum number by adding
the BIAS_CHECKING_RECORDS_MAX_LIMIT environment variable to the deployment
configuration. If you increase the maximum number of records, make sure that you have the
processing power and resources to successfully run them. In the following example,
the BIAS_CHECKING_RECORDS_MAX_LIMIT environment variable is configured to set the
maximum number of records to 1,200,000 records:
"BIAS_CHECKING_RECORDS_MAX_LIMIT": 1200000
References:
Configuring the fairness monitor
https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=monitoring-configuring-fairness-
monitor

© Copyright IBM Corp. 2018, 2022 15-44


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

How it works

• The Watson OpenScale algorithm computes


bias on an hourly basis by using the last N
records (minimum sample size) that are
present in the payload logging table.
ƒ The algorithm perturbs these last N records to
generate additional data.
ƒ The perturbation changes the values of the
feature from the reference group to the
monitored group, or vice-versa.
ƒ The perturbed data is then sent to the model to
evaluate its behavior.
• A model is biased if the percentage of
favorable outcomes for the monitored
group is less than the percentage of
favorable outcomes for the reference
group, by fairness alert threshold value.
Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-33. How it works

The Watson OpenScale algorithm computes bias on an hourly basis by using the last N records
that are present in the payload logging table and the value of N is specified when you configure the
fairness monitor. The algorithm perturbs these last N records to generate additional data.
The perturbation changes the values of the feature from the reference group to the monitored
group, or vice-versa. The perturbed data is then sent to the model to evaluate its behavior. The
algorithm looks at the last N records in the payload table and the behavior of the model on the
perturbed data, to decide whether the model is acting in a biased manner.
A model is biased if the percentage of favorable outcomes for the monitored group is less than the
percentage of favorable outcomes for the reference group, by some threshold value. This
threshold value is specified when you configure the fairness monitor.
Fairness values can be more than 100%. This calculation means that the monitored group
received more favorable outcomes than the reference group. In addition, if no new scoring
requests are sent, then the fairness value remains constant.

© Copyright IBM Corp. 2018, 2022 15-45


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
References:
Fairness metrics overview
https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=openscale-fairness-metrics-overv
iew
Viewing data for a deployment
https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=insights-viewing-data-deploymen
t
Fairness metrics overview
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-fairness-ovr.html?context=cp
daas&audience=wdp
Configuring the fairness monitor
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-monitor-fairness.html?contex
t=cpdaas&audience=wdp

© Copyright IBM Corp. 2018, 2022 15-46


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Example of a bias model

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-34. Example of a bias model

The chart shows and example of a biased model where the percentage of favorable outcomes
(60%) for the monitored group (Female) is less than the percentage of favorable outcomes
(81%) for the reference group (Male), by fairness alert threshold (80%) value.

© Copyright IBM Corp. 2018, 2022 15-47


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

How it works (cont.)


• Disparate impact compares the percentage of favorable outcomes for a monitored group to
the percentage of favorable outcomes for a reference group.
• The fairness scores in Watson OpenScale are calculated with the disparate impact formula.

ƒ num_positives: the number of individuals in the group who received a positive outcome.
ƒ num_instances: the total number of individuals in the group.
ƒ privileged=False label: the monitored group.
ƒ privileged=True label: the reference group.

• The calculation produces a percentage that specifies how often the rate that the monitored group
receives the favorable outcome is the same rate that the reference group receives the favorable
outcome.
• Example: if a model assigns the “no risk” prediction (favorable outcome) to 80% of monitored applicants
(Female) and to 100% of reference applicants (Male), that model has a disparate impact of 80%
Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-35. How it works (cont.)

Disparate impact compares the percentage of favorable outcomes for a monitored group to the
percentage of favorable outcomes for a reference group.
In Watson OpenScale, disparate impact is specified as the fairness scores for different groups.
When you view the details of a model deployment, the Fairness section of the model summary
that is displayed, provides the fairness scores for different groups that are described as metrics.
The fairness scores are calculated with the disparate impact formula.
The num_positives value represents the number of individuals in the group who received a
positive outcome, and the num_instances value represents the total number of individuals in the
group. The privileged=False label specifies unprivileged groups and the privileged=True label
specifies privileged groups. In Watson OpenScale, the positive outcomes are designated as the
favorable outcomes, and the negative outcomes are designated as the unfavorable outcomes. The
privileged group is designated as the reference group, and the unprivileged group is designated as
the monitored group.
The calculation produces a percentage that specifies how often the rate that the unprivileged
(monitored) group receives the positive outcome is the same rate that the privileged (reference)
group receives the positive outcome. For example, if a credit risk model assigns the “no risk”
prediction to 80% of unprivileged applicants and to 100% of privileged applicants, that model has
a disparate impact of 80%.

Reference:
Disparate impact
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-disparate-impact.html?conte
xt=cpdaas&audience=wdp

© Copyright IBM Corp. 2018, 2022 15-48


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

The fairness timeline view

• From the Watson OpenScale


dashboard, the Fairness tile shows the
fairness timeline view.
• A chart displays aggregated
evaluations as data points within
the Time frame and Date range metric
that you specify.
• The evaluation interval is set to 1 week
(default), 1 month or 1 year with the
Watson OpenScale Python SDK.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-36. The fairness timeline view

From the Watson OpenScale dashboard, the Fairness tile shows the fairness timeline view.
A chart displays aggregated evaluations as data points within the Time frame and Date range
metric that you specify. The timestamp of each datapoint that displays when you hover on the
chart does not match the timestamp of the latest evaluation due to the default aggregation
behavior. The latest evaluation for the time frame that you select is displayed during the
associated date range. When you view a batch deployment, the chart can also display the
following metrics:
• The evaluation interval is set to 1 week by default. You can set the evaluation interval to 1
month or 1 year with the Watson OpenScale Python SDK.
• The interval that is specified with the Time frame metric is set to the evaluation interval that
you configure for the monitors.
Because the algorithm checks are run only every hour or every three hours, there are also links
provided to check fairness, drift, and quality on-demand.
From the Schedule pane, you can click the Evaluate fairness now, Evaluate quality now, or
Evaluate drift now links to make an immediate check of your data.

© Copyright IBM Corp. 2018, 2022 15-49


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
References:
Fairness metrics overview
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-fairness-ovr.html?context=cp
daas&audience=wdp
Configuring the fairness monitor
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-monitor-fairness.html?contex
t=cpdaas&audience=wdp
Viewing data for a deployment
https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=insights-viewing-data-deploymen
t
OpenScale Python SDK
https://ibm-watson-openscale-client.mybluemix.net/

© Copyright IBM Corp. 2018, 2022 15-50


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
15.4.Explaining decisions made by ML models
with OpenScale

© Copyright IBM Corp. 2018, 2022 15-51


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Explaining decisions
made by ML models
with OpenScale

Figure 15-37. Explaining decisions made by ML models with OpenScale

© Copyright IBM Corp. 2018, 2022 15-52


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Explaining transaction: Types of explanations


• Local Interpretable Model-Agnostic Explanations (LIME)
ƒ Reveals which features are most important for a specific data point.
ƒ The features with high importance in LIME are the features that are most important for that specific
data point.
• Contrastive explanations
ƒ Reveal how much values need to change to either change the prediction or still have the same
prediction.
ƒ The factors that need the maximum change are considered more important

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-38. Explaining transaction: Types of explanations

For each deployment, you can see explainability data for specific transactions. Depending on the
type of model, it can include different types of analysis, such as LIME, contrastive explanations, or
the ability to test what if scenarios.
Watson OpenScale can generate the following types of explanations to help you understand the
behavior of your model:
LIME
Local Interpretable Model-Agnostic Explanations (LIME) is a Python library that Watson
OpenScale uses to analyze the input and output values of a model to create
human-understandable interpretations of the model. LIME reveals which features are most
important for a specific data point. The 5000 perturbations that are typically done for analysis are
close to the data point. In an ideal setting, the features with high importance in LIME are the
features that are most important for that specific data point. For proper processing of LIME
explanations, Watson OpenScale does not support column names with equals sign (=) in the data
set.
Contrastive explanations
Contrastive explanations reveal how much values need to change to either change the prediction
or still have the same prediction. The factors that need the maximum change are considered more
important, so the features with the highest importance in contrastive explanations are the
features where the model is least sensitive. For contrastive explanations, Watson OpenScale
displays the maximum changes for the same outcome and the minimum changes for a changed
outcome. These categories are also known as pertinent positive and pertinent negative values.
These values help explain the behavior of the model in the vicinity of the data point for which an
explanation is generated.

© Copyright IBM Corp. 2018, 2022 15-53


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
References:
Explaining transactions
https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=insights-explaining-transactions
Explaining unstructured text models
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-insight-explain.html?context
=cpdaas&audience=wdp#ie-unstruct

© Copyright IBM Corp. 2018, 2022 15-54


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Viewing explanations by transaction ID: Transactions list


• Displays all of the transactions that are processed by your model.
• The list contains columns that provide details about the outcome of each transaction.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-39. Viewing explanations by transaction ID: Transactions list

You can view explanations by transaction ID from the Explain a transaction tab in the
OpenScale navigator.
Select a model in the Deployed model list.
The Recent transactions list displays all of the transactions that are processed by your model. The
list contains columns that provide details about the outcome of each transaction.
Click the Explain button in the Actions column.
The Transaction details page provides an analysis of the factors that influenced the outcome of
the transaction.
References:
Viewing explanations by transaction ID
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-insight-explain.html?context
=cpdaas&audience=wdp#ie-unstruct
Explaining transactions
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-insight-explain.html?context
=cpdaas&audience=wdp

© Copyright IBM Corp. 2018, 2022 15-55


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Transaction details
• Provides an analysis of the factors that influenced the outcome of the transaction.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-40. Transaction details

The Transaction details page provides an analysis of the factors that influenced the outcome of
the transaction.
For a transaction, each feature in the model is assigned a percentage of relative weight, which
indicates how strongly the feature influenced the model’s predicted outcome. A negative relative
weight percentage indicates that the feature influenced the model toward a different predicted
outcome.
References:
Explaining transactions
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-insight-explain.html?context
=cpdaas&audience=wdp

© Copyright IBM Corp. 2018, 2022 15-56


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Run analysis
• Shows how different values can change the outcome of the transaction.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-41. Run analysis

If you want to know what feature values will result in a different outcome, Watson OpenScale can
analyze the model and provide a suggestion. From the Inspect tab, click Run analysis. This
analysis takes a few minutes.
References:
Explaining transactions
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-insight-explain.html?context
=cpdaas&audience=wdp

© Copyright IBM Corp. 2018, 2022 15-57


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Run analysis - Results


• Finds the features that will change the outcome from unfavorable (Risk) to favorable (No Risk).

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-42. Run analysis - Results

Reaching a different predicted outcome


For the model to predict a different outcome for this transaction, the value of all listed features
needs to change to the indicated minimum value. Note that changing a feature value by more than
the minimum value might affect the minimum change of other features for the model to predict a
different outcome. Higher feature importance numbers indicate a greater likelihood of changing
the prediction.
If you want to know what feature values will result in a different outcome, Watson OpenScale can
analyze the model and provide a suggestion. From the Inspect tab, click Run analysis. This
analysis takes a few minutes.
References:
Explaining transactions
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-insight-explain.html?context
=cpdaas&audience=wdp

© Copyright IBM Corp. 2018, 2022 15-58


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Explaining image models


• For an image classification model, you can see which parts of an image contributed positively
to the predicted outcome and which contributed negatively.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-43. Explaining image models

Watson OpenScale supports explainability for image data.


For an image classification model example of explainability, you can see which parts of an image
contributed positively to the predicted outcome and which contributed negatively.
The images in the positive pane shows the parts which impacted positively to the prediction. The
image in the negative pane shows the parts of images that had a negative impact on the outcome.
References:
Explaining image models
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-insight-explain.html?context
=cpdaas&audience=wdp

© Copyright IBM Corp. 2018, 2022 15-59


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Explaining unstructured text models


• The explanation shows the keywords that had either a positive or a negative impact on the
model prediction.
• The explanation also shows the position of the identified keywords in the original text that was
fed as input to the model.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-44. Explaining unstructured text models

Explaining unstructured text models


Watson OpenScale supports explainability for unstructured text data.
If you use a Keras model that takes the input as byte array, you must create a deployable function
in IBM Watson Machine Learning. The function must accept the entire text as a single feature in
input and not as text that is vectorized and represented as a tensor or split across multiple
features. IBM Watson Machine Learning supports the creation of deployable functions. For more
information, see Passing payload data to model deployments
Explaining unstructured text transactions
The figure shows an example of explainability for a classification model that evaluates
unstructured text. The explanation shows the keywords that had either a positive or a negative
impact on the model prediction. The explanation also shows the position of the identified
keywords in the original text that was fed as input to the model.
References:
Explaining unstructured text models
https://dataplatform.cloud.ibm.com/docs/content/wsj/model/wos-insight-explain.html?context
=cpdaas&audience=wdp
Passing payload data to model deployments
https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml-deploy-functions_local.
html?context=cpdaas&audience=wdp

© Copyright IBM Corp. 2018, 2022 15-60


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Unit summary • Explain AI ethics and trusted AI


• List IBM’s principles for trust and transparency.
• List IBM’s pillars of trust.
• Describe each IBM pillar of trust.
• Describe the “trustworthy AI toolkits” donated by IBM to the Linux
Foundation.
• Describe the steps and the corresponding tools and resources that
are defined and provided by TensorFlow.
• Describe Microsoft responsible AI principles and toolbox.
• Provide an overview of Watson OpenScale.
• Explain how fairness is configured and monitored by Watson
OpenScale.
• Describe how Watson OpenScale explains decisions that are made
by ML models.

© Copyright IBM Corporation 2018, 2022

Figure 15-45. Unit summary

© Copyright IBM Corp. 2018, 2022 15-61


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Review questions
1. True or False: With Watson OpenScale you can explain the predictions of image classification
models and unstructured text models
2. “People need to be able to understand and evaluate how the systems work and know their
strengths and weaknesses”. Which pillar represents this sentence?
a. Fairness.
b. Explainability.
c. Transparency.
d. Robustness.

3. True or False: The reference group represents the values of the features that are most at risk
for biased outcomes

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-46. Review questions

© Copyright IBM Corp. 2018, 2022 15-62


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Review questions (cont.)


4. Complete the sentence. AI FactSheets 360 is a tool that supports the ______ pillar.
a. Privacy.
b. Explainability.
c. Transparency.
d. Robustness.

5. An AI application notifies users how and when their data will be used, what it is it used for and
by whom. Which pillar does the application supports?
a. Fairness.
b. Explainability.
c. Transparency.
d. Privacy.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-47. Review questions (cont.)

© Copyright IBM Corp. 2018, 2022 15-63


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Review answers
1. True or False: With Watson OpenScale you can explain the predictions of image classification
models and unstructured text models
2. “People need to be able to understand and evaluate how the systems work and know their
strengths and weaknesses”. Which pillar represents this sentence?
a. Fairness.
b. Explainability.
c. Transparency.
d. Robustness.

3. True or False: The reference group represents the values of the features that are most at risk
for biased outcomes

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-48. Review answers

© Copyright IBM Corp. 2018, 2022 15-64


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Review answers (cont.)


4. Complete the sentence. AI FactSheets 360 is a tool that supports the ______ pillar.
a. Privacy.
b. Explainability.
c. Transparency.
d. Robustness.

5. An AI application notifies users how and when their data will be used, what it is it used for and
by whom. Which pillar does the application supports?
a. Fairness.
b. Explainability.
c. Transparency.
d. Privacy.

Getting started with AI ethics © Copyright IBM Corporation 2018, 2022

Figure 15-49. Review answers (cont.)

© Copyright IBM Corp. 2018, 2022 15-65


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
Exercise: Monitoring fairness in a credit risk prediction
model

Figure 15-50. Exercise: Monitoring fairness in a credit risk prediction model

© Copyright IBM Corp. 2018, 2022 15-66


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Exercise • In this exercise, you learn how you can use IBM Watson OpenScale
to monitor your artificial intelligence (AI) models for fairness.
objectives
• After completing this exercise, you will be able to:
ƒ Create a Watson OpenScale service.
ƒ Explore the fairness monitor for a machine learning model.
ƒ Use the explainability feature to understand the causes of bias.
ƒ Configure a debiased version of a machine learning model.

© Copyright IBM Corporation 2018, 2022

Figure 15-51. Exercise objectives

© Copyright IBM Corp. 2018, 2022 15-67


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty
Exercise: Monitoring weather conditions bias in a model that
predicts telecommunications call drops

Figure 15-52. Exercise: Monitoring weather conditions bias in a model that predicts telecommunications call drops

© Copyright IBM Corp. 2018, 2022 15-68


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0
Unit 15. Getting started with AI ethics

Uempty

Exercise • This exercise demonstrates a way to set up Watson OpenScale to


monitor your AI models in an application by using Watson
objectives OpenScale Python Client or SDK. In this exercise, you create a
project and set up a Python notebook on Cloud Pak for Data. Also,
you store custom models on Watson Machine Learning, deploy the
model, and connect the model deployment to Watson OpenScale on
Cloud Pak for Data. Then, you set up Model Fairness with Watson
OpenScale by using a Python notebook.
• After completing this exercise, you will be able to:
ƒ Create a Watson Machine Learning service.
ƒ Create a Watson OpenScale service.
ƒ Configure a database connection for your Watson OpenScale.
ƒ Install OpenScale Python SDK and add a data set by using a Jupyter
notebook.
ƒ Build, deploy, and score your machine learning model by using a Jupyter
notebook.
ƒ Configure fairness monitor for a model on Watson OpenScale.
ƒ Evaluate a model against bias.
© Copyright IBM Corporation 2018, 2022

Figure 15-53. Exercise objectives

© Copyright IBM Corp. 2018, 2022 15-69


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
V12.0

backpg

© Copyright International Business Machines Corporation 2018, 2022.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy