0

I am trying to predict the score for a single data point having 20+ feature including numerical and categorical features.

I have normalised the training data something like this for training the model:

#payment_sequential feature
payment_sequential_train = std_scaler.fit_transform(X_train.payment_sequential.values.reshape(-1,1))
payment_sequential_test = std_scaler.transform(X_test.payment_sequential.values.reshape(-1,1))

#payment_installments feature
payment_installments_train = std_scaler.fit_transform(X_train.payment_installments.values.reshape(-1,1))
payment_installments_test = std_scaler.transform(X_test.payment_installments.values.reshape(-1,1))

Now I want to predict for a single data point for the web app. I am confused, how can I Normalise all the features? I understand that I can pickle each scaler. But that seems like a long process as I have 20+ features.

Any leads on how can I get it done?

Thanks in advance.

  • You can use `scale` to center each column of a dataframe to the mean and scale to unit variance. E.g., `from sklearn.preprocessing import scale; df[:] = scale(df)`. See https://stackoverflow.com/a/72432843/3132408 for more details. – Benjamin Ziepert Dec 25 '22 at 10:33

0 Answers0