0
$\begingroup$

I have data that includes continuous and categorical features. The task is regression and I am looking to remove features that are high correlated with other features (multicollinearity). To do this, I have used pd.get_dummies to one hot encode my categorical features, calculated the correlation matrix, and then removed one variable in each pair of highly correlated variables. Is this the correct way to do this?

Thanks

$\endgroup$
2
  • $\begingroup$ Why remove features? It isn’t a given that this will be beneficial. $\endgroup$
    – Dave
    Commented Sep 20, 2022 at 12:59
  • $\begingroup$ @Dave After I use get dummies, I end up with over 500 features. I have read about fitting the model and then doing feature selection afterwards, and I have also read that removing features before fitting a model will improve the training time. I am just a bit confused about the best route to take $\endgroup$ Commented Sep 20, 2022 at 13:12

1 Answer 1

0
$\begingroup$

You can use frequency or other encoding rather than dummy encoding to make categorical columns numerical and check for multicollinearity

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.