3

sklearn.preprocessing.normalize(X, norm='l2', axis=1, copy=True, return_norm=False)

sklearn.preprocessing.scale(X, axis=0, with_mean=True, with_std=True, copy=True)

for normalize, axis=1 is the default option, but for scale, axis=0 is the dedault one.

I got confused when to use axis=0 or axis=1?

Leon
  • 112
  • 3
  • 12
  • 2
    axis represents the dimension in numpy. For 2-d data, axis=0 means 1st dimension (that is row wise) which is appropriate for scale, because you want to scale the values of different samples for same feature. axis=1 means column wise that is scale each sample indepently. – Vivek Kumar May 18 '17 at 05:43
  • awesome, thank you very much – Leon May 18 '17 at 05:48

0 Answers0