Introduce yourself
Hi, I’m Pradip, a Computer Engineering student and I’m currently learning and working with Python and machine learning. I use scikit-learn for learning and implementing machine learning algorithms and preprocessing techniques.
While going through the MaxAbsScaler documentation and source code, I noticed a discrepancy in the partial_fit() docstring. I’m opening this issue to clarify the documentation and make it consistent with the actual implementation.
Describe the issue linked to the documentation
The X parameter description in MaxAbsScaler.partial_fit() currently states that the data is used to compute the "per-feature minimum and maximum".
However, MaxAbsScaler computes the maximum absolute value for each feature and stores it in max_abs_.
For example:
For the first feature:
minimum = -3
maximum = -2
maximum absolute value = 3
MaxAbsScaler uses 3 as the scaling value. It does not use the minimum and maximum as separate statistics.
The implementation reflects this:
max_abs = xpx.nanmax(xp.abs(X), axis=0, xp=xp)
Therefore, the current wording may confuse users into thinking that MaxAbsScaler computes and uses both the minimum and maximum values independently.
This also appears inconsistent with the class-level documentation, which describes the scaler in terms of the maximum absolute value.
I believe this is a documentation-only issue and does not require any change to the underlying algorithm.
Suggest a potential alternative/fix
I suggest updating the X parameter description in MaxAbsScaler.partial_fit() from:
The data used to compute the per-feature minimum and maximum
used for later scaling along the features axis.
to:
The data used to compute the per-feature maximum absolute value
used for later scaling along the features axis.
This would make the partial_fit() documentation accurately reflect the statistic computed by the implementation and remain consistent with the class-level documentation.
Warning
This issue is not yet ready for a PR. If you are interested in contributing to scikit-learn, please have a look at our contributing guidelines, and in particular the sections for new contributors and the "Needs triage" label.
Introduce yourself
Hi, I’m Pradip, a Computer Engineering student and I’m currently learning and working with Python and machine learning. I use scikit-learn for learning and implementing machine learning algorithms and preprocessing techniques.
While going through the
MaxAbsScalerdocumentation and source code, I noticed a discrepancy in thepartial_fit()docstring. I’m opening this issue to clarify the documentation and make it consistent with the actual implementation.Describe the issue linked to the documentation
The
Xparameter description inMaxAbsScaler.partial_fit()currently states that the data is used to compute the "per-feature minimum and maximum".However,
MaxAbsScalercomputes the maximum absolute value for each feature and stores it inmax_abs_.For example:
For the first feature:
MaxAbsScaleruses3as the scaling value. It does not use the minimum and maximum as separate statistics.The implementation reflects this:
Therefore, the current wording may confuse users into thinking that
MaxAbsScalercomputes and uses both the minimum and maximum values independently.This also appears inconsistent with the class-level documentation, which describes the scaler in terms of the maximum absolute value.
I believe this is a documentation-only issue and does not require any change to the underlying algorithm.
Suggest a potential alternative/fix
I suggest updating the
Xparameter description inMaxAbsScaler.partial_fit()from:to:
This would make the
partial_fit()documentation accurately reflect the statistic computed by the implementation and remain consistent with the class-level documentation.