why does MaxAbsScaler() not set the column range to [-1,1]?
<p>From scikit learn documentation (<a href="http://scikit-learn.org/stable/modules/preprocessing.html" rel="nofollow">http://scikit-learn.org/stable/modules/preprocessing.html</a>), I understand that MaxAbsScaler works by dividing each column by its maximum value. This should set the maximum to be exactly one, i.e equivalent to the transformation df=df/df.max().</p>

<p>This gives me the result I expect:</p>

<pre><code>from sklearn import preprocessing
import numpy as np
import pandas as pd
max_abs_scaler = preprocessing.MaxAbsScaler()

df = pd.DataFrame(np.random.randn(100,50), columns=np.arange(50))
dfdividebymax = df/df.max()
dfdividebymax.max(axis=0)
</code></pre>

<p>is an array of 1s, since every column maximum occurs at least once.
 However,</p>

<pre><code>dftransformed = max_abs_scaler.fit_transform(df)
dftransformed.max(axis=0)
array([ 0.9542721 ,  0.95156696,  0.98142822,  0.86959599,  0.82640483,
        1.        ,  0.71766434,  0.97071355,  1.        ,  1.        ,
        1.        ,  1.        ,  0.96306546,  1.        ,  1.        ,
        0.96927375,  1.        ,  1.        ,  1.        ,  0.90660616,
        1.        ,  0.93072587,  0.90154812,  0.81959713,  0.83557895,
        1.        ,  1.        ,  0.988002  ,  0.89144342,  0.74270055,
        0.66322889,  0.93516648,  0.84134716,  1.        ,  1.        ,
        1.        ,  1.        ,  1.        ,  1.        ,  0.63151867,
        0.86357431,  0.71128973,  1.        ,  1.        ,  1.        ,
        0.69890436,  1.        ,  1.        ,  0.95098563,  0.73306342])
</code></pre>

<p>outputs now several columns whose maximum is strictly less than 1. What is the reason that some maxima are missed?</p>

<p>The missing part lies in the fact that the transformer finds the maximum of the absolute values of your dataframe. As a result, if the absolute value is a negative in your original dataframe, you notice the "inconsistency" you pointed. In other words, in your random dataframe, the maximum absolute values of your first 5 features for instance, have negative values in df. You can see the transformation in line 784 of <a href="https://github.com/scikit-learn/scikit-learn/blob/51a765a/sklearn/preprocessing/data.py#L696" rel="nofollow">source code</a> </p>

python scikit-learn