Logistic Regression in Machine Learning- The powerful classification Technique

Shamim Ahmed
Silicon Earth
Published in
5 min readAug 21, 2018
Image:-https://www.spindox.it

The world of Machine Learning and Artificial Intelligence is being anticipated quite often nowadays. And that has a strong reason in today’s world. The study of data and its impact is strongly going to impact our lives and the time is not the future. The future is now certainly.

The applications of Artificial Intelligence and Machine Learning are endless. And most of us often read hundreds of articles, news, social media posts daily blessing the impact of the Study of data that is making in our lives.

But today i would like to speak about logistic regression. It is a classification technique that is used to determine a whether a query point or object falls in one category or other. Let me simplify it a bit further. Lets take the example that is depicted above. Its about the determination of whether a fruit is apple or not apple.

Generally we use data in our program about the properties of fruits. Its called features in machine learning. Like the roundness, color, taste, seed properties and lot more. And of course we try to provide them in certain dimensions so that computer can understand the same.

So our algorithm processes the data/properties of each fruit. And the data passes through a roller-coaster drive until our machine learns about the data and its properties. More precisely our machine determines whether our provided fruit is an apple or not.

Lets dive into the conceptual part and try to figure out how exactly Logistic Regression works. Consider the image below:

Image result for logistic regression
img:- medium.com

As discussed earlier our aim to predict whether a fruit is apple or not. Now suppose we are given huge set of data and now now our algorithm will learn the properties of the fruits and distinguish whether our fruit is an apple or not. Let us assume the the red dots tells us that our fruit is an apple (say +ve point) and the blue dots tells the fruit isn’t an apple (say -ve point).

The work of logistic regression is to get a boundary or Decision boundary that precisely separates +ve and -ve point as accurate as possible. So we have two classes +ve and -ve.

Assumption of Logistic Regression: Classes are almost/perfectly linearly separable by the decision boundary. And in a large dimensional or n-dimensional plane by equation of plane is given by:-

where w is normal vector perpendicular to the decision surface, w^Tx is plane and b is a constant. From the figure above di is the distance from the +ve point to the plane and dj is the distance from the -ve point to the plane.

Here

is the unit vector.

Now

because our plane and Xi(+ve points) are on the same side of the plane and hence di is +ve.

similarly

because plane and Xj(-ve points) are on the opposite side of the plane and hence dj is -ve.

Let us assume Yi and Yj are the predicted points after the observation of the query point by our Logistic regression model. Then:-

if

then

and

if

then

.

Our Logistic Regression classifier after processing the query points conclude the following:-

if my query points and its predicted output are on the same side of the plane then both

and Yi are +ve. and hence

.

Similarly if my query points and its predicted output are on the different side of the plane then both

and Yi is -ve. and hence

.

The task of logistic regression is to find w & b so that we can find the

, which can almost linearly separate the plane into 2 halves.

Its been too much mathematical above. Lets summarize it simply. Here the whole game is to find out an optimum plane that would significantly separate my points into two different sides. Logistic Regression is all about finding that best plane possible. We call the optimum plane as an ideal plane of our model.

The ideal plane is found after rigorous observation of my query points by my logistic regression model and its equation is given by:-

Where w(star) is my ideal plane. Remember

is called signed distance.

One of the example of Logistic Regression real life case study is as under:-

https://mapr.com

I hope you enjoyed the read do let me know about your experience in the comment section. I would write more blogs about logistic regression in near future along with python code implementation. And stay tuned to my blog for more interesting Machine learning blogs. Thanks for reading folks!

Originally published at www.siliconbuddy.com on August 21, 2018.

--

--

Shamim Ahmed
Silicon Earth

Engineer @McKinsey & Co. Passionate developer who loves to code 👨🏻‍💻, learn, and share knowledge 🌎. LinkedIn: https://linkedin.com/in/shamimio