Npreprocess
Jump to navigation
Jump to search
Purpose
Preprocessing of multi-way arrays.
Synopsis
- [prex,prepar] = npreprocess(x,prepar,undo,options)
- prex = npreprocess(x,setting)
- prex = npreprocess(x,prepar)
- prex = npreprocess(x,prepar,1)
Description
NPREPROCESS is used for three different purposes:
1) for centering and scaling multi-way arrays in which case the parameters (offsets and scales) are first calculated and then applied to the data,
2) for preprocessing another data set according to (1), and
3) for transforming preprocessed data back (undo preprocessing).
Inputs
- x = data array, and
- settings = a two-row matrix (class "double") indicating which modes to center and scale. The matrix is: settings = [cent; scal]. E.g.
- settings(1,:) = [1 0 1] => center across mode one and three, and
- settings(2,:) = [1 1 0] => scale to unit variance within mode one and two.
Optional Inputs
- prepar = contains earlier defined mean and scale parameters, this data is required for applying or undoing preprocessing,
- undo = when set to 1 this flag tells to undo/transform back, and
- options = discussed below.
Outputs
- prex = the preprocessed data, and
- prepar = a structure containing the necessary parameters to pre- and post-process other arrays.
Options
- options = a structure array with the following fields:
- display: [ {'on'} | 'off' ], governs level of display,
- iterproc: [ 'on' | {'off'} ], allows iterative preprocessing which is necessary for some combinations of centering and scaling (see User Manual),
- scalefirst: [ {'on'} | 'off' ], defines that scaling is done before centering which may have implications in complex combinations of preprocessing (see User Manual), and
- usemse: [ {'on'} | 'off' ], defines that mean square scaling is used instead of scaling by standard deviations as is common in two-way analysis.
Examples
To apply preprocessing with options:
[prex,prepar] = npreprocess(x,settings,[],0,options);