0
$\begingroup$

I have a data set that has a few columns such as:

Total cost: mean = 3,000,000

Percent complete: mean = 50

final profit %: mean = 14

I know with such different orders of magnitude before I fit a linear regression I should standardize the data (using python and sklearn). The problem is there are negatives in this data that I need to keep so I don't know which type of standardization I should use? The only two I am familiar with are log transformations and StandardScaler both of which I think get rid of negatives.

$\endgroup$
1
  • $\begingroup$ You can apply standardization to your samples regardless if they are positive or negative. The aim of standardization is to set your sample such that they have a 0 mean and variance 1. In the log case however you need strictly positive values.. $\endgroup$ – null Jun 25 '20 at 21:07
0
$\begingroup$

You can use Normalization. Normalization rescale your mean to 0 and standard deviation to 1 containing both positive and negative value.

$X_{Normalised} = \frac{X - \mu}{\sigma}$

Here $\mu$ is your original mean and $\sigma$ is your standard deviation.

$\endgroup$
0
$\begingroup$

You can still use StandardScaler() as it will keep the negative values. If you think you have a few outliers, and want to reduce their influence, you can also look at RobustScaler().

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.