Normalization of matrices in common use

Source: Internet
Author: User

This is the basic knowledge, the teacher should speak, but the teacher did not say ... In this laboratory, a teacher as long as not in the exam shopping songs, completely disregard the other people exist, to each single primary school brother selling wallets, watches .... That's enough, mental pollution ....

I. Minimum maximum normalization

and interval mapping (I understand the mapping of an interval [a, b] to [c,d],c+ (x-a) * (d-c)/(B-A), no, it should be, the main thing to understand is that the two-part distance mapping is divided by the scale factor (D-C)/(B-A), which you understand, This allows the data to be mapped to [ -1,1] differently, which is mapped to [0,1], which is x ' = (x-min)/(Max-min), where Max and Min are the maximum and small values of the x sequence, not 0 and 1.

The disadvantage of this approach is that if you add new data, Min and Max may change.

Two. Z-score Standardization Method

This method gives the raw data the mean (mean) and standard deviation (standardized deviation) for data Normalization (x-u)/std. The processed data conforms to the standard normal distribution, that is, the mean value is 0 and the standard deviation is 1.

three. L2 Standardization

Thus, we can write the simplest MATLAB source code as follows: first, by line normalization:

% examplesa=[3 4;5 12]; [m n] = size (A);% normalize each row to unitfor i = 1:m    A (i,:) =a (i,:)/norm (A (I,:)); end

Normalized by column.

% normalize each column to unita=[3 4;5 12];for i = 1:n    A (:, i) =a (:, i)/norm (A (:, i)); end


However, the code above is best for functionality, but not optimal, and it is just a code of best understanding of the process. In Matlab, the For loop is a very time-consuming structure, so we should try to use less for loops in our code. As a result, we can use the Repmat command to get another more concise and faster code, but this code for beginners to understand more laborious. Can be regarded as a level of their own advanced bar.

%  normalize per row to UnitA = A./repmat (sqrt (sum (a.^2,2)), 1,size (a,2)),%  normalize per column to UnitA = A./rep Mat (sqrt (sum (a.^2,1)), size (a,1), 1);

Reference: http://blog.sciencenet.cn/blog-810210-655011.html

  http://www.newsmth.net/nForum/#!article/NumComp/108647

Normalization of matrices in common use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.