A detailed analysis of data normalization methods (Mapminmax and MAPSTD) with Matlab

Source: Internet
Author: User


Transferred from: http://blog.sina.com.cn/s/blog_b3509cfd0101bt9u.html



Matlab Neural Network Toolbox comes with two data standard processing commands, one is Mapminmax and the other is MAPSTD. Below, the two commands are parsed separately.






First, Mapminmax



Mapminmax standardizes the data in rows and rows, standardizing each row of data into intervals [Ymin, ymax], with the formula: y = (ymax-ymin) * (x-xmin)/(xmax-xmin) + ymin. If the data for a row is all the same, at which point the divisor is 0, then Matlab xmax=xmin the transformation to y = ymin.






(1) [Y,ps] = Mapminmax (X,ymin,ymax)--The data X is normalized to the interval [Ymin,ymax], ymin and YMAX are the parameters that are set when the Mapminmax function is called, if these two parameters are not set, The default normalization is within the interval [-1, 1]. The normalized data is the structure of y,ps mapping for records normalization.



Example 1 MATLAB Command Window Input: X=12+8*randn (6,8); [Y,ps] = Mapminmax (x,0,1), the random number matrix X is normalized in rows to the interval [0,1] and returns the standard matrix Y and the structure PS (as it is described later), which records information such as the number of rows in X, the maximum and minimum values for each row in X. Over here:



PS =



Name: ' Mapminmax '



Xrows:6



Xmax: [6x1 Double]



Xmin: [6x1 Double]



Xrange: [6x1 Double]



Yrows:6



Ymax:1



ymin:0



Yrange:1



no_change:0



Gain: [6x1 double]



Xoffset: [6x1 Double]






(2) [Y,ps] = Mapminmax (X,FP) -The structure FP that consists of ymin and ymax as a mapping parameter (Fp.ymin and Fp.ymax.) Standardization of the process.



Example 2 MATLAB Command Window Input: Xx=12+8*randn (6,8); Fp.ymin=-2; fp.ymax=2; [YY,PSS] = Mapminmax (XX,FP), the random number matrix X is normalized by line to the interval [ -2,2] and returns the standard matrix YY and structure PSS.






(3) Y = Mapminmax (' Apply ', X,ps) -standardizes the mapped PS according to the given data, standardizing the given data X to Y.


Example 3 on the basis of Example 1, Matlab command Window input: Xxx=23+11*randn (6,8); yyy= Mapminmax (' Apply ', xxx,ps), then standardize the XXX according to Example 1 (the result may not be all in the previously set [Ymin,ymax], depending on the data in XXX compared to the maximum value of the data in X and the minimum value comparison). Note: at this point, the number of lines in XXX must be equal to the number of rows in X (PS), otherwise, the number of columns does not wait.






(4) X = Mapminmax (' reverse ', y,ps) --normalizes the given normalized data Y according to the normalized processing of the mapped PS based on the given data.



Example 4 on the basis of Example 1, Matlab command Window input: Yyyy=rand (6,8); XXXX = Mapminmax (' reverse ', yyyy,ps), according to Example 1 of the standardized mapping, will be YYYY anti-standardization. Note: at this point, the number of rows in the YYYY must be equal to the number of rows of x (recorded in PS), otherwise, the number of columns does not wait.






(5) Dx_dy = Mapminmax (' Dx_dy ', x,y,ps) -Gets the inverse wizard number (reverse derivative) based on the given matrix X, the normalized matrix Y, and the mapping PS. If the given X and Y are the matrices of the M row n columns, then the result dx_dy is an array of 1XN structures, each of which is a diagonal matrix of MXN. This usage is not commonly used and is no longer an example here.












Second, mapstd



MAPSTD standardizes data by row, standardizing each row of data to normalized data with a mean of Ymean (default 0) and a standard deviation of YSTD (default 1), which is calculated as:


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.