In this video, learn what logistic regression is from a conceptual level, how it is different from linear regression, and discover what is going on under the hood.
- [Instructor] In this first lesson of the logistic regression chapter, we're going to talk at a high level about what logistic regression actually is. This chapter will illustrate the structure of how we'll explore each of these algorithms in the next five chapters. So we'll start with a high level overview of what the algorithms is. In the next lesson, we'll explore when you should use it. for the given algorithm. And then the last lesson of each chapter we'll roll that all into fitting and evaluating a few models for the given algorithm. So let's jump in. We're going to start with the definition of regression and then we'll parse out what logistic regression is. So as a general term, regression is a statistical process for estimating the relationships among variables. This is often used to make a prediction about some outcome. Now we saw this example of linear regression in our last chapter. Linear regression is one type of regression that is used when you have a continuous target variable. For instance in this case where we're trying to predict the number of umbrellas sold by the amount of rainfall and the algorithm definition for linear regression is y = mx + b. So that's linear regression. But let's come back to logistic regression. Logistic regression is a form of regression where the target variable or the thing you're trying to predict is binary. So just zero or one, or true or false, or anything like that. why do we need two different algorithms for regression? Why won't linear regression work for a binary target variable? So imagine this plot where we're just using one x feature along the x axis to predict a binary y outcome. This is what that kind of plot would look like. If we use linear regression for a binary target like this, with a best fit line that makes any sense. Linear regression will try to fit a line that fits all of the data and it will end up predicting negative values and values over one, which is impossible. Logistic regression is built off of a logistic or sigmoid curve which looks like this S shape here that you see on the right. This will always be between zero and one, and it makes it a much better fit for a binary classification problem. So we saw the equation that represents What does the equation look like for logistic regression? Basically, it just takes the linear regression algorithm for a line mx + b. And it tucks it up as a negative exponent for e. So our full equation is 1 over 1 + e to the negative mx + b. that makes it a good fit for binary classification problems.
- Models vs. algorithms
- Cleaning continuous and categorical variables
- Tuning hyperparameters
- Pros and cons of logistic regression
- Fitting a support vector machines model
- When to consider using a multilayer perceptron model
- Using the random forest algorithm
- Fitting a basic boosting model