AI
Introduction
Dr. Ali Al-Saegh
Computer Engineering Department, College of Engineering, University of Mosul
1
What AI contains?
2
AI definition
• Artificial intelligence (AI) is intelligence demonstrated by machines,
as opposed to the natural intelligence displayed by humans and
animals.
• AI research has been defined as the field of study of intelligent agents,
which refers to any system that perceives its environment and takes
actions that maximize its chance of achieving its goals.
• To make a system intelligent, we need to learn it! This is called
Machine Learning (ML).
• ML is a main branch of AI. During this course we focuse on ML.
3
Learning
• Learning is acquiring new knowledge, behaviors, skills, values, preferences, or
understandings, and may involve synthesizing different types of information.
• The ability to learn is possessed by humans, animals and some machines. Progress
over time tends to follow learning curves.
4
Machine Learning (ML)
• Machine learning is a scientific discipline that is concerned with the
design and development of algorithms that allow computers to learn
based on data, such as from sensor data or databases.
• A major focus of machine learning research is to automatically learn to
recognize complex patterns and make intelligent decisions based on
data.
• Hence, ML is closely related to fields such as statistics, probability
theory, data mining, pattern recognition.
5
Recognizing patterns
6
Recommender systems
7
Information retrieval
8
Computer vision
9
Robotics
10
Spam and fraud detection
11
Classification
12
ML tasks
• ML deals with the problem of extracting features from data so as to
solve many different predictive tasks:
• Forecasting (e.g. Weather, energy demand prediction, sales)
• Imputing missing data (e.g. Netflix recommendations)
• Detecting anomalies (e.g. Intruders, virus mutations)
• Classifying (e.g. Hand-written digits, cancer diagnosis)
• Ranking (e.g. Google search)
• Decision making (e.g. Robotics, trading )
13
When to apply ML
• Human expertise is absent (i.e. rules cannot be coded) (e.g. Speech recognition)
• Solution changes with time (e.g. Tracking, temperature control, preferences)
• Solution needs to be adapted to particular cases (e.g. Biometrics, personalization)
• The problem size is too big for our limited reasoning capabilities (e.g. Calculating
webpage ranks, matching ads to Facebook pages)
14
Is it a cat?
• Learning systems are not directly programmed to solve a problem,
instead develop own program based on:
• Examples of how they should behave
• From trial-and-error experience trying to solve the problem
15
Variability of data
16
Why use learning?
• It is very hard to write programs that solve problems like recognizing a
handwritten digit.
• What distinguishes a 1 from a 7?
• Instead of writing a program by hand, we collect examples that specify the correct
output for a given input.
• A machine learning algorithm then takes these examples and produces a program
that does the job.
• The program produced by the learning algorithm may look very different from a
typical hand-written program.
• If we do it right, the program works for new cases (unseen data) as well as the ones
we trained it on.
17
Traditional vs. ML models
18
Types of learning – supervised learning
• Supervised learning uses labeled datasets, for example the data is an image of an
apple and the label is apple.
• labeled examples {(xi, yi)} where i=1, 2, 3, …, N. Each element xi is called a feature
vector and yi is the label. The feature vector describes the example somehow.
• These datasets are designed to train or “supervise” an algorithm into classifying data
or predicting outcomes accurately.
• Using labeled inputs and outputs, the model can measure its accuracy and learn over
time.
19
More about labeled datasets
• If each example xi in a dataset represents a person, then
• The first feature in x could contain height in cm
• The second feature in x could contain weight in kg This is how a feature
• The third feature in x could contain gender vector is constructed
• and so on…
• For all examples in the dataset, the feature at position j in the feature vector
always contains the same kind of information.
• The label yi can be either an element belonging to a finite set of classes {red,
green, blue, ….}, or a real number.
20
Types of learning – unsupervised learning
• Unsupervised learning uses machine learning algorithms to analyze and cluster
unlabeled datasets.
• Unlabeled examples {xi}where i=1, 2, 3, …, N.
• These algorithms discover hidden patterns in data without the need for human
intervention (hence, they are “unsupervised”)
21
Main tasks solved by ML
Machine
learning
Supervised Unsupervised
learning learning
Classification Regression Clustering Association
22
Classification
• Classification problems use an algorithm to accurately assign test data (new
unseen samples) into specific classes (categories).
• In a classification problem, a label is a member of a finite set of classes.
• Such as separating apples from oranges.
• Also, classify spam in a separate folder from your inbox.
• There is binary classification ( 2 classes) and multiclass classification (more than 2
classes)
• Linear classifiers, support vector machines, decision trees, and random forest are
all common types of classification algorithms.
23
Regression
• Regression is a problem of predicting a real-valued label (often called a target)
based on a specific case of input.
• Estimating house price based on house features, such as area, the number of
bedrooms, location, and so on is an example of regression.
• Some popular regression algorithms are linear regression, logistic regression and
polynomial regression.
24
Clustering
• Clustering is a problem of learning to assign a label to examples by leveraging an
unlabeled dataset.
• Because the dataset is completely unlabeled, deciding on whether the learned
model is optimal is much more complicated than in supervised learning.
• K-means is the most popular algorithm for clustering.
• Image segmentation is an example of clustering.
25
Association
• Association uses different rules to find relationships between variables in a given
dataset.
• The popular association algorithms are apriori algorithm, Eclat Algorithm, and F-P
Growth Algorithm.
• These methods are frequently used for market basket analysis and
recommendation engines, along the lines of “Customers Who Bought This Item
Also Bought”.
26
Model-Based vs. Instance-Based Learning
• Model-based learning algorithms use the training data to create a model that has
parameters learned from the training data.
• Instance-based learning algorithms use the whole dataset as the model. In
classification, to predict a label for an input example the algorithm looks at the
close neighborhood of the input example in the space of feature vectors and
outputs the label that it saw the most often in this close neighborhood.
Model-based Instance-based 27
ML process
Data Data Training a Evaluating Model
collection preparation model the model deployment
• Collect values • Normalization • Choose appropriate • Use unseen samples • Use the model for a
• Take pictures • Noise removal ML algorithm and to examine the specific application
• Record videos • Dimensionality use the data to build prepared model
reduction a model
28