23.0 Logistic Regression-6
23.0 Logistic Regression-6
SVM (EXAMPLE)
LOGISTIC REGRESSION
EXAMPLE: Hours Study Pass(1)/Fail (0)
29 0
• The dataset of pass or fail in an exam of 5 students
15 0
is given in the table
33 1
• Use logistic regression as a classifier to answer the
following questions: 28 1
29 1
log(odds)= -64+2*hours
LOGISTIC REGRESSION
• We use a Sigmoid Function in logistic
regression
LOGISTIC REGRESSION
1. Calculate the probability of passing for the students who Hours Study Pass(1)/Fail (0)
studied 33 hours.
29 0
The sigmoid function can be written in the form of 15 0
probability as:
33 1
28 1
Now we know the value of z; 29 1
• 2 * hours = 66.94
The student should study at least 33.47 hours, so that
he will pass the exam with more than 95 %
• hours = = 33.47 Hours
probability.
SUPPORT VECTOR MACHINE-Linear
• So, = , then
• Similarly,
• Now we need to calculate the, which will be use to calculate the weight vector
•+
(is present on the positively labeled datasets)
•+
•+
•+
• +
SUPPORT VECTOR MACHINE-Linear
•+
•+
•+
SUPPORT VECTOR MACHINE-Linear
•+ ….. (i)
•+ …..(ii)
• = = -3.5 =
• Finally remembering that our vectors are augmented
with bias
• We can equate the last entry in as the hyperplane
offset b and write the separating
• Hyperplane equation y = wx+b
• With w = and b = -2
SUPPORT VECTOR MACHINE-Linear
•+ ….. (i)
•+ …..(ii)
•+ ….. (i)
•+ …..(ii)
𝜑
( 𝑥1
𝑥2 )=¿
¿ If 2
( 𝑥1
𝑥2 ) Otherwise
SUPPORT VECTOR MACHINE-
(Non-Linear)
• Now we will consider the Positive Examples and try to convert if from one
feature space to another :
•
•
SUPPORT VECTOR MACHINE-
(Non-Linear)
• No we can easily identify the support vectors:
•
SUPPORT VECTOR MACHINE-
(Non-Linear)
• We need to use again the same equation we have used previously
•+
•+
• + = -1
•+ =1
SUPPORT VECTOR MACHINE-
(Non-Linear)
• After simplifying we will be getting:
• + = -1
• +=1
• +9
•=4
SUPPORT VECTOR MACHINE-
(Non-Linear)
• = = -7 =
• Finally remembering that our vectors are
augmented with bias
• We can equate the last entry in as the
hyperplane offset b and write the
separating
• Hyperplane equation y = wx+b
• With w = and b = -3