Machine Learning-Logistic Regression
Logistic Regression aka classification is a subset of Supervised learning. Classification machine learning models depends on the binary output. One such model is the sigmoid function.
Why the sigmoid function:
The main reason why we chose the sigmoid function is that it exists between (0 to 1). Therefore, it is especially used for models where we have to predict the probability as an output. Since the probability of anything exists only between the range of 0 and 1, sigmoid is the right choice. In a sense, the sigmoid function is used to draw decision boundaries.
Sigmoid function Derivation:
where x = X*Θ^T
Quick math: Log(0) = ∞; Log(1) = 0
Equation of cost function when expected output is 1:
Equation of cost function when expected output is 0:
We can combine the above two equations as shown below and it serves as the overall cost function of a logistic model:
Using the logistic model, we can conclude that — the error is infinite when the expected output and predicted output is different and the error is zero when the expected output and predicted output is the same.
Example:
Scenario: To identify a given pictorial number is either 1/2/3/4
Input: 1
We need to train a model with a huge amount of labeled data of the pixel value of each image. The concept involved here is called ‘one vs all’ which compares the input given to a particular category[We have four categories] and brings up the likelihood percentage that it would fall under that category. When the input is given to the model, it returns an array of likely to fall under a category of numbers and it looks like [0.9, 0.1,0.3, 0.2] which corresponds to the category [1,2,3,4]. Hence, it can identify the number as 1.
Training of a model(Regression), error minimization have been discussed here: https://medium.com/@sathiyajithbabusm/machine-learning-591adfe4f81a.
Source:
Lema Labs' workshop is an amazing online learning pitstop for Machine Learning and Artificial Intelligence. Thanks to Pawan and Juswin of Lema Labs in explaining concepts clearly and I wish your team all the best in your future endeavors.