Normaliz: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Scott
imported>Jeremy
No edit summary
Line 6: Line 6:


:[ndat,norms] = normaliz(dat)  
:[ndat,norms] = normaliz(dat)  
:[ndat,norms] = normaliz(dat,''out,normtype'')
:[ndat,norms] = normaliz(dat,''out,normtype,window'')
:[ndat,norms] = normaliz(dat,normtype,options);


===Description===
===Description===


NORMALIZ can be used for pattern normalization, which is useful for preprocessing in some pattern recognition applications and also for correction of pathlength effects for some quantification applications.
NORMALIZ can be used for pattern normalization, which is useful for preprocessing in some pattern recognition applications and also for correction of pathlength effects for some quantification applications. The "norm type" defines the order of normalization  (see algorithm below). Typical values cause each row to be normalized to:
: 1 = the absolute value of the area "under the curve" (sum of the absolute value of all values)
: 2 = the summed squared value of the values (the multivariate vector "length")
: inf = the maximum value in of the row


The input is the data matrix dat. Optional input ''out'' suppresses warnings when set to 0 (zero) {default = 1} (warnings are given if the norm of a vector is zero). Optional input ''normtype'' can be used to specify the type of norm {default = 2}. If ''normtype'' is specified then ''out'' must be included, ''out'' can be empty [].
====Inputs====


The output is the matrix of normalized data ndat where the ''rows'' have been normalized, and the vector of norms used in the normalization norms. Warnings are given for any vectors with zero norm.
* '''dat''' = the data matrix
 
====Optional Inputs====
* '''out''' = flag to suppress warnings about the norm of a vector being zero. Supresses when set to 0 (zero) {default = 0}.
* '''normtype''' = used to specify the type of norm {default = 2}.
* '''window'''  = indices for which columns of '''dat''' should be used to calculate the norm {default = [] which implies all values}
'''NOTE:''' If ''normtype'' is specified then ''out'' must be included, ''out'' can be empty [] giving the default value.
 
Alternatively, the '''out''' and '''window''' options can be passed in an options structure:
 
* '''options''' = An options structure can be passed as third input along with (dat) and (normtype). This input takes the place of the remaining inputs and should contain one or more of the following fields:
** '''display''' : [ 'off' |{'on'}] controls display (replacement for '''out''' input above)
** '''window'''  : replacement for standard (window) input above (default = [])
 
====Outputs====
 
* '''ndat''' = matrix of normalized data where the ''rows'' have been normalized
* '''norms''' = vector of norms used in the normalization


===Algorithm===
===Algorithm===
Line 20: Line 41:
For a 1 by ''N'' vector '''x''', the norm ''n''<sub>x</sub> is given by  
For a 1 by ''N'' vector '''x''', the norm ''n''<sub>x</sub> is given by  
<math>n_{x}=\left( \sum\limits_{j=1}^{N}{\left| x_{i}^{p} \right|} \right)^{1/p}</math> where ''p'' is ''normtype''. The normalized 1 by ''N'' vector '''x'''<sub>n</sub> is given by '''x'''/''n''<sub>x</sub>.
<math>n_{x}=\left( \sum\limits_{j=1}^{N}{\left| x_{i}^{p} \right|} \right)^{1/p}</math> where ''p'' is ''normtype''. The normalized 1 by ''N'' vector '''x'''<sub>n</sub> is given by '''x'''/''n''<sub>x</sub>.
However, when ''p'' is inf (infinity) a simple location of the maximum value replaces the equation above.


===See Also===
===See Also===


[[auto]], [[baseline]], [[mncn]], [[mscorr]], [[polytransform]], [[snv]]
[[auto]], [[baseline]], [[mncn]], [[mscorr]], [[polytransform]], [[snv]]

Revision as of 11:59, 4 April 2013

Purpose

Normalizes rows of matrix to unit vectors.

Synopsis

[ndat,norms] = normaliz(dat)
[ndat,norms] = normaliz(dat,out,normtype,window)
[ndat,norms] = normaliz(dat,normtype,options);

Description

NORMALIZ can be used for pattern normalization, which is useful for preprocessing in some pattern recognition applications and also for correction of pathlength effects for some quantification applications. The "norm type" defines the order of normalization (see algorithm below). Typical values cause each row to be normalized to:

1 = the absolute value of the area "under the curve" (sum of the absolute value of all values)
2 = the summed squared value of the values (the multivariate vector "length")
inf = the maximum value in of the row

Inputs

  • dat = the data matrix

Optional Inputs

  • out = flag to suppress warnings about the norm of a vector being zero. Supresses when set to 0 (zero) {default = 0}.
  • normtype = used to specify the type of norm {default = 2}.
  • window = indices for which columns of dat should be used to calculate the norm {default = [] which implies all values}

NOTE: If normtype is specified then out must be included, out can be empty [] giving the default value.

Alternatively, the out and window options can be passed in an options structure:

  • options = An options structure can be passed as third input along with (dat) and (normtype). This input takes the place of the remaining inputs and should contain one or more of the following fields:
    • display : [ 'off' |{'on'}] controls display (replacement for out input above)
    • window  : replacement for standard (window) input above (default = [])

Outputs

  • ndat = matrix of normalized data where the rows have been normalized
  • norms = vector of norms used in the normalization

Algorithm

For a 1 by N vector x, the norm nx is given by where p is normtype. The normalized 1 by N vector xn is given by x/nx.

However, when p is inf (infinity) a simple location of the maximum value replaces the equation above.

See Also

auto, baseline, mncn, mscorr, polytransform, snv