MTX_PCA_APPLY - PCA model applier

This procedure applies a PCA matrix model to data stored in a matrix.

Usage

The MTX_PCA_APPLY stored procedure has the following syntax:
MTX_PCA_APPLY(modelName,matrixToProject,outputMatrix,numberOfVectors)
Parameters
modelName
The name of the created model.
Type: NVARCHAR(ANY)
matrixToProject
The name of the matrix to be projected using the PCA model.
Type: NVARCHAR(ANY)
outputMatrix
The name of the matrix in which to store the result.
Type: NVARCHAR(ANY)
numberOfVectors
The number of principal components used in projection.
Type: INT4
Returns
BOOLEAN TRUE always.

Details

This procedure applies a PCA transformation constructed using PCA to the provided Database Matrix Object. Each row of the provided matrix is projected on the number of principal components, specified by the numberOfVectors parameter. If an applied model was constructed with centering and scaling operations, the corresponding operations are performed on the provided data using model coefficients based on the original set.

Examples

call nzm..shape('1,2,3,4,5,6,7,8,9',1,4,'PCA_TEST'); 
call nzm..shape('9,8,7,6,5,4,3,2,1',100,1,'PCA_TEST_SOURCE');
call nzm..gemm('PCA_TEST_SOURCE','PCA_TEST','PCA_TEST_VALS');
call nzm..mtx_pca('PCA_TEST_MOD','PCA_TEST_VALS',FALSE, TRUE,TRUE);
    std dev in each direction (in this example real value of all 
    components other than the first one should be 0)
call nzm..print('PCA_TEST_MOD_PCA_SDEV');
---projecting on the original value (first column) 
call nzm..mtx_pca_apply('PCA_TEST_MOD','PCA_TEST_VALS',
'PCA_TEST_PROJ',1);
call nzm..delete_all_matrices();

 SHAPE
-------
 t
(1 row)

 SHAPE
-------
 t
(1 row)

 GEMM
------
 t
(1 row)
 
 MTX_PCA
---------
 t
(1 row)

                                      PRINT
---------------------------------------------------------------------------------
 -- matrix: PCA_TEST_MOD_PCA_SDEV --
 22.0237717020326e-16
 8.1474073981796e-17
 7.9324562134617e-33
(1 row)

 MTX_PCA_APPLY
---------------
 t
(1 row)

 DELETE_ALL_MATRICES
---------------------
 t
(1 row)