In my experience, the choice between linear regression and logistic regression depends on the type of problem you are trying to solve and the nature of the output variable. I like to think of it this way: linear regression is used when you want to predict a continuous outcome variable based on one or more input features. On the other hand, logistic regression is used when you want to predict a categorical outcome variable (usually binary) based on one or more input features.
For example, in a project I worked on where we wanted to predict the sales price of houses based on their features, we used linear regression because the output we were trying to predict (price) was a continuous variable. However, in another project where we wanted to predict whether a customer would make a purchase or not based on their browsing behavior, we used logistic regression because the output was binary (purchase or no purchase).
To sum up, use linear regression when predicting a continuous variable and logistic regression when predicting a categorical (usually binary) variable.
For example, in a project I worked on where we wanted to predict the sales price of houses based on their features, we used linear regression because the output we were trying to predict (price) was a continuous variable. However, in another project where we wanted to predict whether a customer would make a purchase or not based on their browsing behavior, we used logistic regression because the output was binary (purchase or no purchase).
To sum up, use linear regression when predicting a continuous variable and logistic regression when predicting a categorical (usually binary) variable.