Do you do linear regression in logistic regression? I just studied single & multiple linear regression 2 days ago now I'm reading about logistics regression and I want to implement it from scratch, I just want to know If my understanding about logistic regression is correct.
You see I was actually quite confused about logistic regression, In my understanding in logistics regression we still use the equation of linear regression
$$\hat{y} = \hat\beta_0+\hat\beta_1x_1+\cdots+\hat\beta_nx_n$$
so what I think is happening here is:

*

*first find the best-fit-line, and for that to happen we need to find  the beta coefficient just like multiple linear regression

*after finding the $\hat\beta$ coefficients, we plug them in the sigmoid function along with our independent variables to get the prediction, $$P(x) = \frac{1}{1+e^{-(b_0+b_1x_1+...+b_nx_n)}}$$ and then that's it.

Is that how it's done? or was that wrong? or was there some steps we need to do first or after?

The simplest way of likening logistic regression to standard linear regression is using the latent variable interpretation.  The logistic regression model can be described by considering the observable responses:
$$Y_i = \mathbb{I}(Y_i^* > 0),$$
based on the unobservable latent variables:
$$Y_i^* = \beta_0 + \beta_1 x_{i,1} + \cdots + \beta_m x_{i,m} + \varepsilon_i
\quad \quad \quad \varepsilon_1, ... \varepsilon_n \sim \text{IID Logistic}(0, s).$$
As you can see, in this model form the latent response variable follows a linear regression model with an error term that has a logistic distribution.  We observe whether the latent response variable is above zero or not, but we do not observe its actual value.  For estimation purposes, this manifests in a substantial difference in estimating the coefficients in the model.  We do not estimate using OLS estimation, so this is not "just like multiple linear regression".  Nevertheless, we do indeed get estimated coefficients and this does get us an estimated function for the conditional probability of the response outcome, so there are certainly similarities.
