Constrainfit: Difference between revisions
imported>Rasmus No edit summary |
imported>Rasmus No edit summary |
||
Line 7: | Line 7: | ||
: [A]=constrainfit(XB,BtB,Aold); % Unconstrained | : [A]=constrainfit(XB,BtB,Aold); % Unconstrained | ||
: '''Setting global constraints on A''' | |||
: opt = constrainfit('options'); | : opt = constrainfit('options'); | ||
: opt.type='nonnegativity'; | : opt.type='nonnegativity'; | ||
: [A]=constrainfit(XB,BtB,Aold,opt); % Nonnegative | : [A]=constrainfit(XB,BtB,Aold,opt); % Nonnegative | ||
: '''Setting constraints on just one column of A''' | |||
: opt = constrainfit('options'); | : opt = constrainfit('options'); | ||
: opt.type='columnwise'; | : opt.type='columnwise'; | ||
Line 19: | Line 21: | ||
CONSTRAINTFIT solves the least squares problem behind bilinear, trilinear and other multilinear models. Assuming a model '''X''' = '''A'''*'''B''' ' and assuming that '''X''' and '''B''' are known, the least squares estimate of '''A''' is obtained. Rather than using '''X''' and '''B''' this algorithm uses the cross product matrices ('''X''' ' '''B''') and ('''B''' ' '''B''') which are generally smaller and less memory-demanding especially in multi-way models. | CONSTRAINTFIT solves the least squares problem behind bilinear, trilinear and other multilinear models. Assuming a model '''X''' = '''A'''*'''B''' ' and assuming that '''X''' and '''B''' are known, the least squares estimate of '''A''' is obtained. Rather than using '''X''' and '''B''' this algorithm uses the cross product matrices ('''X''' ' '''B''') and ('''B''' ' '''B''') which are generally smaller and less memory-demanding especially in multi-way models. | ||
CONSTRAINFIT can do a number of general types of regression problems such as nonnegativity-constrained regression, regression with column-orthogonality of '''A''' etc. These constraints are simply set in the option field 'type', e.g. option.type='nonnegativity'. Thus, for most problems, only the 'type' field needs to be set. CONSTRAINFIT will provide a least squares solution to most of these problems. | |||
CONSTRAINFIT can also find '''A''' subject to different constraints on different columns. In this case, the update of '''A''' will be an improvement of the initially provided estimate '''Aold'''. As CONSTRAINFIT is used inside iterative algorithms, an improvement is sufficient to guarantee overall convergence. | |||
====Inputs==== | ====Inputs==== | ||
* ''' | * '''XB''' = This is the matrix '''X''' ' '''B'''. | ||
* '''BtB''' = This is the matrix '''B''' ' '''B'''. | |||
* '''Aold''' = An initial estimate of '''A'''. | |||
====Optional Inputs==== | ====Optional Inputs==== | ||
* ''' | * '''options''' = provides definitions for which type of constraint to impose. | ||
====Outputs==== | ====Outputs==== | ||
* ''' | * '''A''' = The improved estimate of '''A'''. | ||
===Options=== | ===Options=== |
Revision as of 11:26, 21 October 2008
Purpose
Finds A minimizing ||X-A*B'|| subject to constraints, given the small matrices (X ' B) and (B ' B)
Synopsis
- [A]=constrainfit(XB,BtB,Aold); % Unconstrained
- Setting global constraints on A
- opt = constrainfit('options');
- opt.type='nonnegativity';
- [A]=constrainfit(XB,BtB,Aold,opt); % Nonnegative
- Setting constraints on just one column of A
- opt = constrainfit('options');
- opt.type='columnwise';
- opt.columnconstraints={0;2;0}; % If three columns
- [A]=constrainfit(XB,BtB,Aold,opt); % Second column unimodal
Description
CONSTRAINTFIT solves the least squares problem behind bilinear, trilinear and other multilinear models. Assuming a model X = A*B ' and assuming that X and B are known, the least squares estimate of A is obtained. Rather than using X and B this algorithm uses the cross product matrices (X ' B) and (B ' B) which are generally smaller and less memory-demanding especially in multi-way models.
CONSTRAINFIT can do a number of general types of regression problems such as nonnegativity-constrained regression, regression with column-orthogonality of A etc. These constraints are simply set in the option field 'type', e.g. option.type='nonnegativity'. Thus, for most problems, only the 'type' field needs to be set. CONSTRAINFIT will provide a least squares solution to most of these problems.
CONSTRAINFIT can also find A subject to different constraints on different columns. In this case, the update of A will be an improvement of the initially provided estimate Aold. As CONSTRAINFIT is used inside iterative algorithms, an improvement is sufficient to guarantee overall convergence.
Inputs
- XB = This is the matrix X ' B.
- BtB = This is the matrix B ' B.
- Aold = An initial estimate of A.
Optional Inputs
- options = provides definitions for which type of constraint to impose.
Outputs
- A = The improved estimate of A.
Options
options = a structure array with the following fields:
- plots: [ {'none'} | 'final' ] governs plotting of results, and
- order: positive integer for polynomial order {default = 1}.
Example
>>This is an example Error: does not exist