LDA vs Logistic Regression in ML
LDA vs Logistic Regression in ML
The linear decision boundary in LDA when two classes follow Gaussian distribution and have an identity covariance matrix passes through the midpoint of the centers and is orthogonal to the line joining the centers. In this case, the decision boundary can be determined by calculating the midpoint of the centers (6, 8) and (-6, -4), which is (0, 2), and the line orthogonal to the line joining the centers, resulting in x + y = 2 as the decision boundary .
Logistic Regression is preferred for binary classification due to its use of the sigmoid function, which outputs values between 0 and 1, aligning with binary outcomes. LDA, however, is directly applicable to multi-class problems. Regarding outliers, Logistic Regression is more robust due to its sigmoid transformation, which dampens outlier effects, whereas LDA is sensitive because its objective function relies heavily on distances, which can be skewed by outliers .
When Logistic Regression is applied to a dataset where the number of features exceeds the number of samples, it is prone to overfitting. This occurs because the model can perfectly fit or memorize the training data due to the abundance of features, leading to a lack of generalizability to new data .
A dataset is linearly separable if Logistic Regression can classify it with zero training error. For instance, examining the provided datasets, Dataset 1 is linearly separable as it can achieve zero training error without transformations due to its distinct class separation, whereas Dataset 2 cannot achieve zero training error as its class overlap makes it not linearly separable .
LDA might fail to classify two classes perfectly if the classes have the same mean. This is because LDA relies on finding a linear separator based on differences in class means. If the means are identical, no linear decision boundary can properly separate the classes, as they are not linearly separable .
PCR is an unsupervised technique that focuses on maximizing the variance in the dataset, while LDA is a supervised technique aiming to maximize the separation between classes based on their means. These differences highlight PCR's focus on variance without class labels and LDA's focus on class separation using labels .
If linear regression is used to predict an exponential relationship directly, it will likely give inaccurate predictions because linear regression assumes a linear relationship between variables. This issue can be circumvented by transforming the variable to make the relationship linear, such as applying a log transformation to the exponential component, aligning the relationship with the linear assumption of the model .
Logistic regression can be used in sensitivity analysis to assess how varying input features affects the probability of a certain outcome. It provides probabilistic outputs that are suitable for sensitivity analysis by quantifying the effect of each input variable on the predicted probability. However, logistic regression assumes a linear relationship between the input features and the log odds, which can limit its ability to accurately capture non-linear influences .
To apply linear regression to model Y = me^X + c, we can transform the independent variable X by taking the natural logarithm. This results in a linear relationship between Y and the transformed variable ln(e^X), which simplifies to a linear relationship Y = ln(m) + X⋅ln(e) + c. Thus, by plotting e^X values against Y values, linear regression can be used to estimate the slope ln(e) and intercept c .
When two Gaussian distributed classes with an identity covariance matrix and equal prior probabilities are analyzed using LDA, the decision boundary is linear and centered at the midpoint of the class means. Since the covariance is identical, the line is orthogonal to the line joining the class centers. This symmetry due to equal priors ensures the decision boundary equally separates the two classes in feature space, maximizing class separation .