medpy.features.utilities.normalize#

medpy.features.utilities.normalize(vector, cutoffp=(0, 100), model=False)[source]#

Returns a feature-wise normalized version of the supplied vector. Normalization is achieved to [0,1] over the complete vector using shifting and scaling.

When cut-off percentile (cutoffp) values other than (0, 100) are supplied, the values lying before or behind the supplied percentiles are cut-off i.e. shifted to fit the range.

When model is set to True, an additional model describing the normalization is returned, that can at a later point be passed to the normalize_with_model function to normalize other feature vectors accordingly to the one passed.

The vector is expected to have the form samples*features i.e.:

    s1    s2    s3    [...]
f1
f2
[...]

Therefore a supplied vector:

    s1    s2    s3
f1   1.5    1    2
f2    -1    0    1

would result in the returned vector:

    s1    s2    s3
f1 0.50  0.00  1.00
f2 0.00  0.50  1.00
Parameters:
vectorsequence

A sequence of feature vectors to normalize.

cutoffp(float, float)

Cut-off percentiles.

modelbool

Whether to return the learned normalization model.

Returns:
normalized_feature_vectorsndarray

The normalized versions of the input vectors.

modeltuple, optional

The learned normalization model.