what is the purpose of adding the intercept in regression. why we are adding the bias.
How we can predict if we have only dependent variable not any independent variable.
For linear models, the intercept is the value of the linear predictor when all covariates are zero. In linear regression, this is equivalent to the y-intercept of the line of best fit. In logistic regression, it is the log odds of the baseline group. Suppose we did not add an intercept term for the regression. We would then be positing that when all covariates are 0, the linear predictor is 0. In summation, we add the bias to improve interpretability and add flexibility to the model.
Having no independent variables means no prediction can be made. Suppose you have a model for cancer incidence based on age. Since you do not know my age, you can not put my data into your model, and thus you can not make predictions.
The intercept represents the base assumption. Let's say you build an algorithm to classify cats and dogs where +1 is cat and -1 is dog. A model with an intercept of -1 will always assume the case is a dog unless enough variables prove it is a cat. This is especially likely to happen when you have severe class imbalance.
If your goal is performance, keep the intercept. If your goal is to determine feature importance, do not fit an intercept. By setting the base assumption to zero you force the model to select features for both cat and dog classes - no cheating!