I am trying to prepare a data set to train an ANN model, therefore I need to apply scaling. However some of my variables are continous and some are already in a binary form. Below an example of how a given row from my X_train data set looks like:
array([[0.0, 1.0, 654, 1, 40, 5, 105683.63, 1, 1, 0, 173617.09]])
I have applied the following code to normalize my values:
from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X_train = sc.fit_transform(X_train)
However, this returns me an array with also the scaled binary values. Is there a way to avoid this happening?
Thank you in advance!
You should use the Pipeline with the Column Transformer for mixed types. Here is a good example of how to apply different preprocessing and feature extraction pipelines to different subsets of features.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.