1 ModuleEcontent - Session5

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Outline

01 Fitting Function to Data Point


02 Classification

03 Regression
Fitting Function to Data Point

Y= F(x)

X Model y

F(x)

Given a data set D = {(xi, yi)} the objective is to learn the relationship
between features and the target.
Its a supervised machine learning technique.

Use an object characteristics to identify which


class/category it belongs to

Classification Example:

A new email is ‘spam’ or ‘non-spam’


A patient diagnosed with a disease or not
A short circuit fault had occurred or not
Binary
Classification
?
𝒙
Binary
Classification
𝐶𝐵
?
𝒙
Binary
Classification
𝐶𝑅
𝐶𝐵
?
𝒙

Binary
Classification
𝐶𝑅
𝑩 𝑹
𝐶𝐵
?
d(x, 𝑪𝑩 ) d(x, 𝑪𝑹 )
𝒙

Binary
Classification d(x, 𝑪𝑩 ) > d(x, 𝑪𝑹 ) => 𝑹
𝐶𝑅
d(x, 𝑪𝑩 ) < d(x, 𝑪𝑹 ) => 𝑩
𝑩 𝑹
d(x, 𝑪𝑩 ) d(x, 𝑪𝑹 )
--------- ---------
𝐶𝐵 ? 𝑥 σ σ
Binary
Classification σ 𝒌
(𝑿 𝑹
𝒊 − µ 𝑹 )𝟐
σ𝟐 = 𝒊=𝟏
𝐶𝑅 𝒌
σ𝒌𝒊=𝟏 𝑿𝑹
𝒊
µ=
𝒌

Density of the two classes don’t match


Clustering
𝑯𝒂𝒓𝒅 𝑪𝒍𝒂𝒔𝒔𝒊𝒇𝒊𝒄𝒂𝒕𝒊𝒐𝒏
?
Hard and Soft = 𝒙

Classification 𝑺𝒐𝒇𝒕 𝑪𝒍𝒂𝒔𝒔𝒊𝒇𝒊𝒄𝒂𝒕𝒊𝒐𝒏

P( = ) = 0.6
P( = ) = 0.4
When h=0 ; P= 1/ (1+exp^(-h)) =1/2 =0.5
h is large +ve value exp^(-h) is very small = 1/1= thus probability of getting a Blue is
100%
h is large -ve value exp^(-h) is very large thus probability =0 for getting a Blue is 0%

𝑆𝑜𝑓𝑡 𝐶𝑙𝑎𝑠𝑠𝑖𝑓𝑖𝑐𝑎𝑡𝑖𝑜𝑛
?
𝒙
1
P( = ) =
1+exp(−ℎ)

ℎ = 𝑋2 - m𝑋1 - C
Neural Networks

ℎ = 𝑤1 𝑥1 + 𝑤2 𝑥2 + 𝑐
v=𝜎 ℎ

x1 ℎ′ = 𝑤′1 𝑥1 + 𝑤′2 𝑥2 + 𝑐’
∗ ∗
ℎ∗ = 𝑤1 𝑣 + 𝑤2 𝑣 ′ + … . . +c

∗ ∗
v′ = 𝜎 ℎ′ v =𝜎 ℎ

x2

ℎ𝑚 = 𝑤𝑚1 𝑥1 + 𝑤𝑚2 𝑥2 + 𝑐m
v𝑚 = 𝜎 ℎ𝑚
Regression
Polynomial Curve Fitting
Polynomial Curve Fitting
Polynomial Curve Fitting

+ 𝒘𝟑 𝒙𝟑
Polynomial Curve Fitting
Polynomial Curve Fitting

Degree Training Data Test Point


(M) Error Error
0 0.9
1 0.7
3 0.1
9 0
Polynomial Curve Fitting

Degree Training Data Test Point


(M) Error
0 0.9 0.2
1 0.7 0.1
3 0.1 0
9 0 0.3

Over Fitting
References

[1] STTP on ‘Basics of IoT and AI’ course Material, IIT, Kanpur

[2] Christopher M Bishop: Pattern Recognition & Machine Leaning, Springer, pp. 362,
2006

[3]http://playground.tensorflow.org/#activation=tanh&batchSize=10&dataset=circle&reg
Dataset=regplane&learningRate=0.03&regularizationRate=0&noise=0&networkShape=4,
2&seed=0.58088&showTestData=false&discretize=false&percTrainData=50&x=true&y=tr
ue&xTimesY=false&xSquared=false&ySquared=false&cosX=false&sinX=false&cosY=fal
se&sinY=false&collectStats=false&problem=classification&initZero=false&hideText=fal
se

You might also like