03 Logistic Regression
03 Logistic Regression
Objectives
𝑝=
1
1+𝑒 −𝑦
𝑦 = 𝑤0 + 𝑤1𝑋1 + 𝑤2𝑋2 + ⋯ + 𝑤𝑛𝑋𝑛
𝑝=
1
1+𝑒 −(𝑤0+𝑤1𝑋1+𝑤2𝑋2+⋯+𝑤𝑛𝑋𝑛
The Sigmoid Function
The sigmoid function, also called logistic function gives an ‘S’ shaped
curve that can take any real-valued number and map it into a value
between 0 and 1.
If the curve goes to positive infinity, y predicted will become 1, and if
the curve goes to negative infinity, y predicted will become 0.
If the output of the sigmoid function is more than 0.5, we can classify
the outcome as 1 or YES, and if it is less than 0.5, we can classify it as 0
or NO.
For example: If the output is 0.75, we can say in terms of probability
as: There is a 75 percent chance that patient will suffer from cancer.
Properties
Accuracy Score
Confusion Matrix
Precision
Recall
F1 Score
Receiver Operating Characteristic (ROC) Curve
Accuracy Score
If we put our focus into one score, we might end up neglecting the
other.
In order to combat this we can use the F1 Score, which strikes a
balance between the Precision and Recall scores.
𝐹1 𝑆𝑐𝑜𝑟𝑒 = 2 ∗
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 ∗𝑅𝑒𝑐𝑎𝑙𝑙
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛+𝑅𝑒𝑐𝑎𝑙𝑙
ROC Curve