Cov cv: Difference between revisions
Jump to navigation
Jump to search
imported>Donal |
imported>Donal No edit summary |
||
Line 26: | Line 26: | ||
* '''ccov''' = the regularized (inverse and/or sqrt) covariance. | * '''ccov''' = the regularized (inverse and/or sqrt) covariance. | ||
* '''results''' = a structure array with the following fields | * '''results''' = a structure array with the following fields | ||
===Options=== | |||
''options'' = a structure array with the following fields: | |||
* '''display''': [ 'off' | {'on'} ], governs level of display to command window, | |||
* '''plots''': [ 'none' | {'final'} ], governs level of plotting. | |||
* '''condmax''': {1e4} maximum regularization (condmax>1). This is the maximum condition number for (ccov). | |||
* '''inverse''': [ {'yes'} | 'no' ] If set to 'yes' {default} the inverse covariance matrix is estimated. If set to 'no' the output (ccov) is a regularized covariance matrix. | |||
* '''sqrt''': [ {'no'} | 'yes' ], governs if the output is sqrt of the cov. | |||
* '''algorithm''': [ 2 ], regularization method where ac = S(1)/options.condmax | |||
algorithm = 1: results.alpha = (ac./(ac+S))*ac ; | |||
algorithm = 2: results.alpha = (ac^2./(ac^2+S.^2))*ac ; | |||
algorithm = 3: results.alpha = ac*ones(1,length(S)) ; | |||
===Example=== | ===Example=== |
Revision as of 16:36, 2 September 2010
Purpose
Estimation of a regularized inverse covariance matrix.
For (x) M by N, COV_CV estimates a regularized inverse of x'*x/(M-1).
If [V,S] = svd(x'*x/(M-1)), and S = diag(S); then the regularized inverse takes the form V*diag(1./(S+alpha))*V'.
The 1 by N vector alpha is output in (results.alpha) [see options.algorithm].
Synopsis
- [ccov,results] = cov_cv(x,options);
Inputs
- x = X-block class "double" or "dataset".
Optional Inputs
- options = structure array with the following fields discussed below.
Outputs
- ccov = the regularized (inverse and/or sqrt) covariance.
- results = a structure array with the following fields
Options
options = a structure array with the following fields:
- display: [ 'off' | {'on'} ], governs level of display to command window,
- plots: [ 'none' | {'final'} ], governs level of plotting.
- condmax: {1e4} maximum regularization (condmax>1). This is the maximum condition number for (ccov).
- inverse: [ {'yes'} | 'no' ] If set to 'yes' {default} the inverse covariance matrix is estimated. If set to 'no' the output (ccov) is a regularized covariance matrix.
- sqrt: [ {'no'} | 'yes' ], governs if the output is sqrt of the cov.
- algorithm: [ 2 ], regularization method where ac = S(1)/options.condmax
algorithm = 1: results.alpha = (ac./(ac+S))*ac ;
algorithm = 2: results.alpha = (ac^2./(ac^2+S.^2))*ac ;
algorithm = 3: results.alpha = ac*ones(1,length(S)) ;
Example
load nir_data [ccov,results] = cov_cv(spec1); axis([0 50 1e-8 1]), vline(results.ncomp), hline(results.s(1)/results.options.condmax) title(['nir_data: 30x401 ',get(get(gca,'title'),'string')],'interpreter','none'), figfont