You are on page 1of 20

Machine Learning

BY: WAHAB KHAN


Lecture objectives
Today lecture objective are:
To highlight importance of Machine Learning
To introduce the most basic and common task of Data mining e.g
The classification
To uncover supervised learning
To introduce the simplest supervised learning model e.g. the
Hidden Markov Model(HMM).
Machine Learning
These days Machine learning based technique strike the shores of Data mining like Tsunami
Researchers prefigure that artificial intelligence will surmount mankind in galore activities in the
succeeding decade(Grace et al., 2017)

When Will AI Exceed Human Performance?

2053
2049

2031
2026 2027
2024

Grace, K., Salvatier, J., Dafoe, A., Zhang, B. , and Evans, O. 2017. When Will AI Exceed Human Performance? Evidence from AI
Experts. arXiv preprint arXiv:1705.08807.
Machine Learning
The state of the art approaches adopted for development NLP
and Data mining tolls are based on Machine Learn (ML) models
The core reason behind its wide usage is based on four features:
◦ The capability of automatic learning
◦ The degree of accuracy
◦ The speed of processing and
◦ Generic nature
Machine Learning Models
The most common machine learning models are
◦Hidden Markov Model (HMM)
◦Conditional Random fields(CRF)
◦Support Vector Machine(SVM)
◦Recurrent Neural Network (RNN)
ML Types
ML models can be:
I. Supervised learning based
II. Unsupervised
For Supervised learning training data(pre-labeled data) is
mandatory
Supervised learning
Train Data

<LOCATION>‫<پیرس‬/LOCATION> ‫میں شدت پسند حملوں‬


‫< سے منسلک ایک اور شدت پسند‬PERSON> ‫عبدالقدیر حکیم‬
ML Models
‫<مدنی‬/PERSON> ‫< بھی‬TIME>‫<دو روز‬/TIME> ‫قبل‬ Train Model files
<LOCATION>‫<عراق‬/LOCATION> ‫شہر‬ ‫کے‬
<LOCATION>‫<موصل‬/LOCATION> ‫میں مارا گیا ہے۔‬
Module
Test Data
</Location> ‫< عراق‬/Location>
‫ایک قدیم ملک ہے‬ ML Models
‫عراق ایک قدیم ملک ہے‬
Test Module
Classification Task
What is a classification Task?
◦In classification task we are given some observation and
our job is to determine which of a set of classes it belongs
to
Examples are:
◦Part of speech tagging(POS)
◦Named entity recognition(NER)
◦Sentiment analysis
‫‪NE as Classification Problem‬‬
‫”‪Assign a label “Y” to an Observation “X‬‬

‫لوگ ٹریفک‬
‫مسلم لیگ‬
‫قومبڑی تعداد‬
‫دھرنا‬ ‫خروشعمران‬ ‫مایو‬
‫جوش و‬
‫‪Person‬‬
‫دس سالنقصان‬ ‫س‬
‫خان‬
‫ٹی‬ ‫لڑکی لیڈر ای پی‬
‫‪Location‬‬
‫=‬
‫بھارت‬ ‫‪Organization‬‬
‫معیشت‬ ‫اں‬
‫واہگہ بارڈر‬ ‫ک‬ ‫پولی‬
‫اربوں ڈالر‬ ‫بیتابں آئی‬
‫چیئرمین‬
‫سمجھوتا‬
‫سما‬ ‫س نظر‬
‫نقص‬
‫‪Date‬‬
‫‪Time‬‬
‫پرویز رشید‬ ‫عوا‬ ‫عامہ‬
‫ایکسپریس‬
‫بی غریالہور‬
‫‪Number‬‬
‫جنگ بلدیاتی‬ ‫م‬ ‫پہنچن‬ ‫‪Designation‬‬
‫انتحابات‬ ‫بی ے ب‬
‫شروعجلسہ‬
‫بھاری‬
‫سی‬

‫}‪{X‬‬ ‫}‪{Y‬‬

‫‪9‬‬
HMM Model
Model is represented by:
M= (A, B,)

◦ Where A represents matrix of transition probabilities


◦ B represents matrix of observation, likelihood or emission probabilities
◦  Represents a vector of initial probabilities
Markov Assumption
First assumption
The Probability of a word appearing is dependent only on its own
tag : that is it is independent of other words around it, and the other
tags around it

The first assumption yields emission probability matrix (B)


Markov Assumption
Second assumption
The probability of tag appearing is dependent on its previous tag.
Also known as bigram assumption

The second assumption yields transition probability matrix (A)


Testing
The equation which estimates the most probable tag sequence is
Transition probabilities
The Transition probability matrix is calculated by the following formula
Emission probabilities
The emission probabilities are calculated as
Example
Suppose we are confuse in deciding what task(Walk, Shop or Clean)
we should to do today based on the Sunny and Rainy status of the
today weather.
So here the walk shop and Clean are our observation the testing data
Sunny and Rainy are our states or class labels
Transition Matrix (A)
#//Rainy to Rainy, Rainy to Sunny
#//Sunny to Rainy, Sunny to Sunny
Rainy Sunny
Rainy 0.7 0.3
Sunny 0.4 0.6

0.7
Rainy

0.6
Start 0.4 0.3

0.4 Sunny
0.6
Emission Matrix (B)
#//Given Rainy, the probability to walk, shop, clean
#//Given Sunny, the probability to walk, shop, clean
Rainy Sunny
Walk 0.1 0.6
Shop 0.4 0.3
Clean 0.5 0.1
Walk =0.1
Rainy Shop=0.4
0.6 Clean=0.5
Start
Walk =0.6
0.4 Sunny Shop=0.3
Clean=0.1
Results
You are welcome…..
Questions ?
Suggestions !!

You might also like