I have a dataset with the following variables:

price (numerical, min 350, max 25400)
model_age_days (numerical, min 423,  max 3405)
factor_1 (dummy)
factor_2 (dummy)
factor_3 (dummy)
factor_58 (dummy)

So the model has 60 columns, 58 age of which are One Hot Encoded dummy variables (created using pandas its get_dummies feature). So for each row, most columns will have a value of 0

I am training a classifier to predict the factor (but will likely perform other types of analysis later) , using a 'One vs the Rest' approach for each factor and am now trying to decide how to preprocess the data.

My question is as follows:

Am I correct in assuming that this dataset could be considered sparse and that, following the Sklearn documentation the MaxAbsScaler is thus almost mandatory?

MaxAbsScaler and maxabs_scale were specifically designed for
scaling sparse data, and are the recommended way to go about this. 

I'm asking this since I would like to create a 2d graph (using PCA) later, but the tutorials / documentation seem to suggest that the StandardScaler is preferred for PCA.

  • $\begingroup$ It depends what you want to do with the data. For some algorithms it won't matter (random forest) for some it will (lasso). $\endgroup$ – Tim Aug 17 '18 at 10:40
  • $\begingroup$ Thanks for you response! I am I correct in understanding that, for the algorithms that require standardisation (lets say, SVM) a MaxAbsScaler would be the way to go here? $\endgroup$ – Jasper Aug 17 '18 at 11:05

Your Answer

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

Browse other questions tagged or ask your own question.