I am trying a use multi linear regression model to predict the salaries of employees. I have a total of 88 dependent features from which 19 are categorical and the rest are continuous. I have managed to reduced the number of continuous features from 69 to 41. Now I am trying to reduce the number of categorical features, but since my data is not normally distributed I cannot use a t-test or ANOVA. Which other tests can I use to see if the features are significant to predict the target?
-
$\begingroup$ Feature selection is discussed in many places. A search will get you there. stats.stackexchange.com/search?q=feature+selection. Some people advise no feature selection. If the subject matter experts decided these are important features, then that is the answer. Also suppressor variables run through the wrong univariate feature selection algorithm can hurt the model. stats.stackexchange.com/questions/73869/…. Careful with feature selection. $\endgroup$– CraigCommented Apr 13, 2020 at 10:24
-
$\begingroup$ @Craig Thank you for your response. Thank you for sending the link it has actually helped me a lot. I would like to ask if the same interpretation would apply if there is very strong linear relationship between 2 variables? I would also like to add that my data set comprises of data from different sources compiled together. $\endgroup$– Ahmed JyadCommented Apr 13, 2020 at 17:53
-
$\begingroup$ Multicollinearity does not often hurt a glm model's predictive performance - assuming that it is not perfectly collinear. It can hurt coefficient interpretation as multicollinearity increases the standard errors of the coefficients. If you are modeling to understand the coefficients and take action based on them (like many models in econometrics, pharmacy, etc) then reducing the collinearity may be worthwhile. If you care about predictive power, then multicollinearity is not a big thing to worry about. In glm types of models. A search can show many techniques for multicollinearity. $\endgroup$– CraigCommented Apr 14, 2020 at 10:11
-
$\begingroup$ @Craig Thanks lot for your reply! It was been really helpful. :) $\endgroup$– Ahmed JyadCommented Apr 14, 2020 at 17:39
2 Answers
Be careful with feature selection! Do not rely solely on feature selection techniques. They might be misleading sometimes. Here is the process I usually follow:
1.) The very first thing to do is build a baseline model where you consider all the features and record the performance. This will give you a baseline score to compare with. (Do not perform hyperparameter tuning here!)
2.) Now you perform feature engineering, where you see if you can combine multiple feature into one single one. For example you have 3 features as date, month and year of sale of a car. You can combine all 3 of them into a single feature age. This will reduce the dimension of your dataset.
3.) Here you try to remove any outliers/nonsensical values from features. For example in the case of predicting the price of car, you have year of car as 1900. This is a nonsensical value and won't help the model. You can safely remove it. (be carefull how you deal with outliers as removing them is not the only solution but thats a whole another topic in itself!)
4.) Now you can perform feature selection. There a quite a few techniques you can use like filter based, wrapper based and hybrid techniques. But don't just blindly use of these as they might be misleading. Instead use subject matter expertise first to remove any redundant features (which is what I usually do).
Applying all the above things will usually result in the removal of redundant features. If not only then go for feature selection techniques mentioned in point 4.).
Hope it helps you!
If I understand your question correctly, you are asking how to reduce categorical features in a dataset. If yes, then a few of the approaches I can think of are:
Iterative Process - Build a model with all numerical features and one categorical feature then evaluate your improvement of the model by whatever metrics you are using and then add other categorical features and so on. So if you have N categorical features you will be building N+1 models.
chi square test of predictor and target variables.
(what I use) Build a model with all the available features and measure its performance and then use the feature importance functionality of that model to determine which features are important. In the case of linear regression, the higher the value of the coefficient the better the feature. Alternatively, you can use L1 regularization to check for non zero features. Do check for multi-collinearity before considering feature importance in linear regression.
-
$\begingroup$ Thank you for your response! However, I have a few question for each of your suggestions (1) If I have N cat variables, how do I end up with N+1 models, is the +1 model one without cat variables. (2) Is it possible to Chi Square Test for cat variables if the target is continuous? (3) How do I check Multicollinearity cat variables? $\endgroup$ Commented Apr 13, 2020 at 17:44