You are on page 1of 15

MACHINE

LEARNING
DR. SAEED UR REHMAN
Department of Computer Science,
COMSATS University Islamabad
Wah Campus
Summary of Ch 1
 What Is Machine Learning?
 Examples of Machine Learning Applications
Learning Associations
Classification
Regression
Unsupervised Learning
Reinforcement Learning

DEPARTMENT OF COMPUTER SCIENCE, COMSATS UNIVERSITY ISLAMABAD - WAH CAMPUS


Introduction to Machine Learning
Outline
Ch 2 Supervised Learning
 Vapnik-Chervonenkis (VC) Dimension
 Probably Approximately Correct (PAC) Learning
 Noise
 Learning Multiple Classes
 Regression
 Model Selection and Generalization
 Dimensions of a Supervised Machine Learning Algorithm

DEPARTMENT OF COMPUTER SCIENCE, COMSATS UNIVERSITY ISLAMABAD - WAH CAMPUS


Introduction to Machine Learning
Ch 2 : Supervised Learning
 The machine learning task of learning a function
that maps an input to an output based on example
input-output pairs.
Therefore we need
 Training Data , that a supervised learning algorithm
analyzes the training data and produces an inferred
function, which can be used for mapping new
examples.
 This requires the learning algorithm to generalize
from the training data to unseen situations in a
"reasonable" way
DEPARTMENT OF COMPUTER SCIENCE, COMSATS UNIVERSITY ISLAMABAD - WAH CAMPUS
Introduction to Machine Learning
Supervised Learning
Supervised[labelled data]
◦ Classification
◦ Regression

Unsupervised [unlabeled data]


◦ Clustering
◦ Association

Semi Supervised[some labelled data]


Reinforcement Learning [reward based ]

DEPARTMENT OF COMPUTER SCIENCE, COMSATS UNIVERSITY ISLAMABAD - WAH CAMPUS


Introduction to Machine Learning
Learning a Class from Examples
Class C of a “family car”
◦ Prediction: Is car x a family car?
◦ Knowledge extraction: What do people expect from a family
car?
Output:
Positive (+) and negative (–) examples
Input representation:
x1: price, x2 : engine power

DEPARTMENT OF COMPUTER SCIENCE, COMSATS UNIVERSITY ISLAMABAD - WAH CAMPUS


Introduction to Machine Learning
Training set X
X  {xt ,r t }tN1

 1 if x is positive
r 
0 if x is negative

 x1 
x 
x2 

DEPARTMENT OF COMPUTER SCIENCE, COMSATS UNIVERSITY ISLAMABAD - WAH CAMPUS


Introduction to Machine Learning
Class C

p1  price  p2  AND e1  engine power  e2 


DEPARTMENT OF COMPUTER SCIENCE, COMSATS UNIVERSITY ISLAMABAD - WAH CAMPUS
Introduction to Machine Learning
Hypothesis class H

 1 if h says x is positive
h( x)  
0 if h says x is negative

DEPARTMENT OF COMPUTER SCIENCE, COMSATS UNIVERSITY ISLAMABAD - WAH CAMPUS


Introduction to Machine Learning
Outcomes of Classification

DEPARTMENT OF COMPUTER SCIENCE, COMSATS UNIVERSITY ISLAMABAD - WAH CAMPUS


Introduction to Machine Learning
Confusion Matrix
The confusion matrix visualizes the accuracy of a classifier by
comparing the actual and predicted classes. The binary confusion
matrix is composed of squares:

https://www.guru99.com/confusion-matrix-machine-learning-example.html

DEPARTMENT OF COMPUTER SCIENCE, COMSATS UNIVERSITY ISLAMABAD - WAH CAMPUS


Introduction to Machine Learning
Accuracy, Precision, Recall
Interpretation of Performance Measures
Accuracy tells you how many times the ML model was
correct overall.
Accuracy = TP+TN/TP+FP+FN+TN
Precision is how good the model is at predicting a specific
category.
Precision = TP/TP+FP
Recall tells you how many times the model was able to
detect a specific category.
Recall = TP/TP+FN
DEPARTMENT OF COMPUTER SCIENCE, COMSATS UNIVERSITY ISLAMABAD - WAH CAMPUS
Introduction to Machine Learning
Why you need Confusion
matrix?
•t shows how any classification model is confused when it makes
predictions.
•Confusion matrix not only gives you insight into the errors being
made by your classifier but also types of errors that are being made.
•This breakdown helps you to overcomes the limitation of using
classification accuracy alone.
•Every column of the confusion matrix represents the instances of
that predicted class.
•Each row of the confusion matrix represents the instances of the
actual class.
•It provides insight not only the errors which are made by a classifier
but also errors that are being made.

DEPARTMENT OF COMPUTER SCIENCE, COMSATS UNIVERSITY ISLAMABAD - WAH CAMPUS


Introduction to Machine Learning
Definitions
A true positive is an outcome where the
model correctly predicts the positive class. Similarly,
A true negative is an outcome where the
model correctly predicts the negative class.
A false positive is an outcome where the
model incorrectly predicts the positive class. And
A false negative is an outcome where the
model incorrectly predicts the negative class.

DEPARTMENT OF COMPUTER SCIENCE, COMSATS UNIVERSITY ISLAMABAD - WAH CAMPUS


Introduction to Machine Learning
DEPARTMENT OF COMPUTER SCIENCE, COMSATS UNIVERSITY ISLAMABAD - WAH CAMPUS
Introduction to Machine Learning

You might also like