SoFunction
Updated on 2024-11-15

How to implement normalization based on python

This article introduces how to achieve normalization based on python processing, the text of the sample code through the introduction of the very detailed, for everyone's learning or work has a certain reference learning value, you can refer to the following friends

I. Definitions

There are two forms of normalization methods, one is to change the number into a decimal between (0, 1) and the other is to change a measured expression into a dimensionless expression. It is mainly proposed for the convenience of data processing, mapping the data to be processed within the range of 0 to 1, which is more convenient and faster.

II. Purpose

Different evaluation indicators often have different quantitative outlines and quantitative units, such a situation will affect the results of data analysis, in order to eliminate the influence of the quantitative outlines between the indicators, data standardization is needed to address the comparability of data indicators. Its specific target is singular sample data, singular sample data refers to the sample vector that is particularly large or small relative to other input samples, such as [0.34,0.51,0.44,222] [0.34,0.51,0.44,128] in the last column element is singular sample data.

III. Common standardized methods

1. max-min normalized mapping to the interval [0,1]

-score normalized results clustered around 0 with variance of 1

IV. Normalization of matrices

To normalize the columns of a matrix is to take the value of each column of the matrix and divide it by the absolute value of the sum of the squares of all the elements of each column, which results in the sum of the squares of the elements of each column of the matrix being 1.

V. python normalization

where the parameter axis=0 means that columns also span rows axis=1 means that rows also span columns


data=([
[1000,10,0.5],
[765,5,0.35],
[800,7,0.09],])
data=normalize(data,axis=0,norm='max')
print(data)
>>[[1.1.1.]
[0.7650.50.7]
[0.80.70.18]]

This is the whole content of this article.