Skip to content Skip to sidebar Skip to footer

Scaling Test Data To 0 And 1 Using Minmaxscaler

Using the MinMaxScaler from sklearn, I scale my data as below. min_max_scaler = preprocessing.MinMaxScaler() X_train_scaled = min_max_scaler.fit_transform(features_train) X_test_sc

Solution 1:

If you can scale all your data in one shot this would be better because all your data are managed by the Scaler in a logical way (all between 0 and 1). But for the SVM algorithm, there must be no difference as the scaler will extend the scale. There's still the same difference even if it is negative.

In the documentation we can see that there are negative values so I don't think it has an impact on the result

Solution 2:

For this scaling it probably doesn't matter much in practice, but in general you should not use your test data to estimate any parameters of the preprocessing. This can severely bias you results for more complex preprocessing steps.

There is really no reason why you would want to concatenate the data here, the SVM will deal with it. If you would be using a model that needs positive values and your test data is not made positive, you might consider another strategy than the MinMaxScaler.

Post a Comment for "Scaling Test Data To 0 And 1 Using Minmaxscaler"