Can a logistic regression model support an imbalanced classification?

Can a logistic regression model support an imbalanced classification?

Logistic regression does not support imbalanced classification directly. Instead, the training algorithm used to fit the logistic regression model must be modified to take the skewed distribution into account.

How to use default weights in logistic regression?

After above test-train split, lets build a logistic regression with default weights. For minority class, above model is able to predict 14 correct out of 29 samples. For majority class, model got only one prediction wrong. Model is not doing a good job in predicting minority class.

What to do with imbalanced data in regression?

There have been good questions on handling imbalanced data in the classification context, but I am wondering what people do to sample for regression. Say the problem domain is very sensitive to the sign but only somewhat sensitive to the magnitude of the target.

How are the coefficients of logistic regression modified?

Logistic regression can be modified to be better suited for logistic regression. The coefficients of the logistic regression algorithm are fit using an optimization algorithm that minimizes the negative log likelihood (loss) for the model on the training dataset.

How is weighting related to error in logistic regression?

The weighting is applied to the loss so that smaller weight values result in a smaller error value, and in turn, less update to the model coefficients. A larger weight value results in a larger error calculation, and in turn, more update to the model coefficients.

Why is imbalanced distribution a challenge for class prediction?

Such high imbalanced distribution pose a challenge for class prediction. The reason being most of the classifiers are designed or have default values assuming equal distribution of each label. Slight imbalance does not pose any challenge and can be treated like a normal classification problem.

Is there a Python library for weighted logistic regression?

Although straightforward to implement, the challenge of weighted logistic regression is the choice of the weighting to use for each class. The scikit-learn Python machine learning library provides an implementation of logistic regression that supports class weighting.