ModelIn structure

The ModelIn structure contains the necessary informations for CuBatch to handle one session.
It contains the following fields:

- constraints
- data
- file
- modelname
- nbfactors
- options
- valmethod
- sam
- samlabs
- var
- xpointer

c onstraints:

The constraint field is a vector of structures where each element correspond to a specific constraint.
The constraints currently implemented are 6 (and are available depending on the model):

1. 'closure'
2. 'equality'
3. 'non-negativity'
4. 'orthogonality'
5. 'threeway'
6. 'unimodality'

The fields of the constraint structure are the following:

algorithm | name of the algorithm to fit the constraints
modes | row vector where each element is set to one if the constraint is applied to a mode (dimension/way)
constants | vector (or scalar) defining possible constants required by the constraint
core | core constraints
factors | factor constraints (for equality constraints)
name | name of the constraint
value | 1 if the constraint is applied, 0 otherwise

data:

this field (also a structure) contains the informations on the data selection and possibly a rearranged form of the data array (when requested by the fitted model).

augmentedmatrix | The unfolded data matrix (built from several single matrices)
dataparafac2 | Special format of the data matrix to apply the PARAFAC2 model (cell array because of slabs of different size)
initialinput | Initial inputs for OPA 3D
sam,samlabs,var | these three fields are empty in the current version of CuBatch. In future version they will substitute the corresponding fields in ModelIn
sizes | Vector of sizes of different slabs (useful for PARAFAC2 and PCA model (multiple sets))

file:

It contains the information on the data imported in CuBatch. It is a vector of 2 structures where the first element refers to X and the second to Y.

file | full path for the file containing the array
matrices | name of the array loaded in the file. In case of multiple sets it is a cell vector with the name of each set as elements
size | empty in case of single sets and a vector with the number of rows (or horizontal slabs) of each set.

The fields 'matrices' and 'size' overlap some of the features of the CBDataSet object

modelname:

String of characters with the name of the model.

nbfactors:

Structure with two fields

- min: scalar or vector with the lowest model dimension being used
- max: scalar or vector with the largest model dimension being used

options:

> algorithm | Options regarding the algorithm used to fit a specific model. The values may change depending on the model itself
> constants | vector of constants for fitting the model (e.g. convergence criterion, initialisation, etc)
> maxiter | max number of iterations, it may be a vector (e.g. for PARAFAC) when more
> name | name of the actual algorithm employed in fitting
> value | vector of constants for fitting the model (e.g. convergence criterion, initialisation, etc)
commonmodes | Number of modes which are common for X and Y in IV-Tucker. By definition they have to be placed first. (use edit/permute if data ar not well organised). example: X = batches *time * wavelength Y = batches *time* process variables In this case, there are 2 common modes (the 2 first).
rotate | rotation of the core after Tucker model. 0: no rotation. 1: maximise the rotation of the core. 2: maximise the slice-wise diagonale of the core. 3: maximise the squared variance of the core.
species | 'val': validation part 'met': method part
direction | gives the direction in which the OPA model is applied. The user can look the the direction of the first mode or of the second one. Can take the values 1 or 2

valmethod:

String defining the validation method, if any. Possible values are:

- 'cv', cross validation (has to be changed in 'loo' in the future)
- 'loo', leave one out validation
- 'nboo', naïve bootstrapping
- 'rboo', residual bootstrapping
- 'test', test set validation

sam:

Structure relative to samples/batches selection. It uses the marklab object. Some fields are a remnant from earlier versions of CuBatch where sample groups were allowed

sample | samples included in the sample group. The vector contains the position of the sample (i.e. the index referring to the horizontal slabs of X) constituing the sample group. One cannot change this field using the GUI.
name | Name of the sample-group. Not accessible from the GUI. By default is 'All Samples'
sel | marklab object defining the selection of the samples (i.e. calibration set/test set, etc)
cen | vector of length two. The first element refers to centring in X and the second to centring in Y.
scal | vector of length two. The first element refers to scaling in X and the second to centring in Y.

samlabs:

Label object referring to the samples. Although it is redundant (it is accessible by means of X), it is saved here for simplicity as in this fashion there is no need to move around the whole data set every time the labels are requested or to extract them.

var:

Is the equivalent of sam only referring to the variables. It is a vector of structures, each element referring to a data array (currently only X - the first - and Y - the second).

dims | dimensions of the array (excluding the first which is retained in ModelIn.sam
name | Name of the array
sel | marklab object defining the selection of the variables in the different modes
cen | vector of length equal to the number of dimensions of the array of reference minus one (i.e. the sample/batch mode). The nth element refers then to the centring across the nth+1 mode of the array of reference
scal | vector of length equal to the number of dimensions of the array of reference minus one (i.e. the sample/batch mode). The nth element refers then to the scaling within the nth+1 mode of the array of reference

xpointer:

Handle to CuBatch main figure. It allows not to pass the data array as a parameter to subroutines reducing the risk of problems in the memory management.