问题描述:

I have the following numpy array:

from sklearn.decomposition import PCA

from sklearn.preprocessing import normalize

import numpy as np

# Tracking 4 associate metrics

# Open TA's, Open SR's, Open SE's

associateMetrics = np.array([[111, 28, 21],

[ 27, 17, 20],

[ 79, 23, 17],

[185, 125, 50],

[155, 76, 32],

[ 82, 24, 17],

[127, 63, 33],

[193, 91, 63],

[107, 24, 17]])

Now, I want to normalize every 'column' so that the values are between 0 and 1. What I mean is that the values in the 1st column for example should be between 0 and 1.

How do i do this?

normed_matrix = normalize(associateMetrics, axis=1, norm='l1')

the above gives me rowwise normalization

网友答案:

I was able to do this using the following:

normalized_metrics = normalize(associateMetrics, axis=0, norm='l1')
相关阅读:
Top