I have a dataset with both numerical and categorical features (variables), I converted all the categorical variables in dummies, then I split the train and test data.

Now I am at the step where I want to standardize the features before fitting the model.

  1. Should I apply the standardisation to all the features or only to the numerical ones?

  2. In this case, is it preferable to use the MinMax scaler on a range 0 to 1?

1) Dummy variables doesn't need to be standardized, just numerical ones, but if you use MaxMin scaler you can pass both numerical and dummy variables because this scaler doesn't change the values of dummy variables, try to apply the equation to dummy variables to see.

$$ z_i=\frac{x_i-\min(x)}{\max(x)-\min(x)} $$

2) That's a trick question and the response is: it depends. If you have some outlier in your data MaxMin doesn't fit well, because this outlier will be replaced by 0 or 1 and the rest of data will be confined in a very restricted range of values, in this case you should use a normal scaler.

  • Thanks, so if I apply the scaler to all the dataset (including dummies) to save the time of separating the columns in the dataframe, will be the resulting data biased? – user3089520 Apr 16 at 19:34
  • It can bias your learner and the fact you have your core data confined in a small range diffcults the learner to learn. – romulomadu Apr 17 at 16:38

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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