-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG + 1] ENH: preprocess: adding a max-normalization option #4695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This still needs tests and doc updates.
Ah, older scipy versions don't have a |
Column-wise max? I guess why not. I think you should use |
Thanks! Travis is happy now. |
_, norms = min_max_axis(X, 1) | ||
norms = norms.repeat(np.diff(X.indptr)) | ||
mask = norms != 0 | ||
X.data[mask] /= norms[mask] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we should raise a ValueError "else". If you could add that and add a test, it would be much appreciated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind, missed the check above.
lgtm. |
LGTM. Merging. Thanks! |
[MRG + 1] ENH: preprocess: adding a max-normalization option
I've found that max-normalization is about as common as l1 or l2 normalization in my work, so I added that option to the
preprocessing.normalize()
function.