I have a feature vector with One-Hot-Encoded features and with continous features.

How can I decide now, which data I shall scale with StandardScaler and which data scale with MinMaxScaler? I think I do not have to scale the one-hot-encoded anyway because they are already between 0 and 1.

(I use afterwards a MLPClassifier)

  • 3
    $\begingroup$ Rule of thumb: Use StandardScaler for normally distributed data, otherwise use MinMaxScaler. $\endgroup$ – Simon Larsson Jan 14 '19 at 16:06

StandardScaler and MinMaxScaler are more common when dealing with continuous numerical data.

One possible preprocessing approach for OneHotEncoding scaling is "soft-binarizing" the dummy variables by converting softb(0) = 0.1, softb(1) = 0.9. From my experience with feedforward Neural Networks this was found to be quite useful, so I expect it to be also benefitial for your MLPClassifier.

StandardScaler is useful for the features that follow a Normal distribution. This is clearly illustrated in the image below (source).

enter image description here

MinMaxScaler may be used when the upper and lower boundaries are well known from domain knowledge (e.g. pixel intensities that go from 0 to 255 in the RGB color range).


In "Python Machine Learning" by Raschka the author provides some guidance on page 111 when to normalize (min-max scale) and when to standardize data:

Although normalization via min-max scaling is a commonly used technique that is useful when we need values in a bounded interval, standardization can be more practical for many machine learning algorithms. The reason is that many linear models, such as the logistic regression and SVM, [...] initialize the weights to 0 or small random values close to 0. Using standardization, we center the feature columns at mean 0 with standard deviation 1 so that the feature columns take the form of a normal distribution, which makes it easier to learn the weights. Furthermore, standardization maintains useful information about outliers and makes the algorithm less sensitive to them in contrast to min-max scaling, which scales the data to a limited range of values.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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