4
$\begingroup$

I am working with an imbalanced dataset involving fraud. The aim is to use Logistic regression to predict if new observations are legitimate or fraudulent.

I currently plan to perform normalisation, one hot encoding, principle component analysis and then a hybrid of over/under sampling to make my test/train sets more balanced.

I'm not sure the order in which to so these, do I normalise before doing one hot encoding or afterwards?

$\endgroup$
2
  • 1
    $\begingroup$ What are you normalizing? You don't need to normalize categoricals for encoding. $\endgroup$
    – doubllle
    Commented Jun 22, 2020 at 10:49
  • 1
    $\begingroup$ You do one hot encoding on categorical variables right? How would you normalize them? $\endgroup$
    – Ale
    Commented Jun 22, 2020 at 10:49

2 Answers 2

2
$\begingroup$

In cases when its needed (e.g. when using regularization) I apply normalization after OHE ([0,1] -> [-1,1]). This makes their mean zero and variance 1 and thus compatible with the remaining N(0,1) normalized variables and prevents those dummy columns getting unfair advantage in the regularization process with what would be otherwise 0.5 means.

$\endgroup$
1
$\begingroup$

One hot encoding its just aplicable to categorical data, so there is no need to "normalize" what is already categorical. Although, the rest of your numerical data should be normalized.

I reccomend to do the one hot encoding of your categorical data first, cause if you normalize with min-max a 0-1 one hot encoding, they stay the same.

$\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.