How to scale data properly with multiple groups I have a data set in R for training a neural network with 17431 samples, 10 variables and the data consist of two groups, "0" and "1". See below for a snippet of the data set.

I want to scale the data so that each variable (column) has 0 mean and 1 sd, but I'm not sure if I should use observations from both groups when I scale each variable, or if I only should use observations from each group (label) when I scale the corresponding variable. That is, should I only use data with label "0" when I calculate mean and sd for scaling data labeled "0" and equally for data labeled "1"? Or can I use the column mean and sd for each variable and ignore the labeling?


Or can I use the column mean and sd for each variable and ignore the labeling?

Yes, this is the proper way to scale your features.
Also note that, when you scale the test data (assuming you do not know the labels), which one would you choose if you had scaled different labels differently?
