Logistic regression is used for binary classification problems — where you have got some examples which arson and other cases which are off. You get as input a training group; that has some examples of each course together with a label stating whether each instance icon or away. The purpose is to learn a model from the training data so you can predict the label of new illustrations which you have not seen before and do not understand the tag of. For one example, Suppose you have data describing a whole lot of buildings and earthquakes E.g., year the building was constructed, kind of substance used, strength of earthquake ,etc, and also you know whether every building collapsed on or not off in every past earthquake. Using this data, you want to make predictions about whether a given building will fall in a hypothetical future earthquake.

One of the first Models that are worth trying is logistic regression. Coding it up was not working on this specific problem, but I had been working on something near. Being you to practice what preach, started searching for a dead simple Python logistic regression class. The only requirement is that I wanted it to support L2 regularization more on this later am also sharing this code with a whole lot of different people on many platforms, so wanted as few dependencies on external libraries as possible. Could not find what needed, so decided to take **domycoding** stroll down memory lane and apply it myself. have written it in C++ and Mat lab before but not in Python. Will not do the derivation, but there are loads of great explanations on the market to follow if you are not scared of a little calculus. Do a little Goggling for logistic regression derivation

The major idea is to write down the probability of the information given a few setting of internal parameters, then to take the derivative, which will let you know how you can change the inner parameters to make the information more likely. Got it good for those of you outside There that understand logistic regression indoors and out, have a look at how short the train method is. I really like how simple it is to do in Python. Caught a little indirect flak during March madness season for speaking about how regularized the latent vectors in my matrix-factorization version of team offensive and defensive strengths when predicting outcomes in NCAA basketball. Apparently people thought I was talking crap mad, right.